Announcement

Collapse
No announcement yet.

ADO-Recordset in memory

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ADO-Recordset in memory

    Hello,
    I have a nice probleme creating an ADO-Recordset in memory.
    In VB or VBA there is no problem. I create the object, add the fields say rst.open an create records.
    Now I use the includes from Jose Roca. Very fine files, many tool-functions.
    I create the object, add the fields (can access the fields-collection an read the properties).
    Then I say rst.open - and the program crashes. I've no idea, why, but it crashes. The same happens with the include created by the original COM-Browser from PB.

    May be, someone has an idea?
    Many thanks
    Christian

  • #2
    PB is neither VB nor VBA. It does not support default values. Therefore, you have to pass the parameters:

    Try:

    Code:
    DIM vOptPrm AS VARIANT
    vOptPrm.vt = %VT_ERROR
    vOptPrm.scode = %DISP_E_PARAMNOTFOUND
    
    rs.CursorLocation = %adUseClient
    rs.Open(vOptPrm, vOptPrm, %adOpenKeyset, %adLockOptimistic, %adCmdUnspecified)
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Thanks for replying Jose,
      I tried your code (PB 10.03) but PB does'nt allow periods for the variant-variable. I think this is FB-like and I have to operate with memory-functions (POKE and PEEK), where I not know how this may be possible.

      Comment


      • #4
        Sorry. Use:

        Code:
        DIM vOptPrm AS VARIANT
        vOptPrm = ERROR %DISP_E_PARAMNOTFOUND
        Forum: http://www.jose.it-berater.org/smfforum/index.php

        Comment


        • #5
          There is no documentation in PB for such matter.
          Thanks very much! This works!

          Comment


          • #6
            Just for reference, see also..
            Create VT_DATE variant Datatype 9-14-09

            I also did the same thing to create a VT_BOOL.. (Code here somewhere but it's an easy copy from above). The MSMQ interface requires a VT_BOOL datatype. If a LONG is used (what PB automatically substitutes) it will always come up as false.

            PB does not support VT_DATE, VT_BOOL or VT_DECIMAL (used for very large numbers.. returned by Oracle's OLE interface for some datatypes) types so make sure you check when using a new COM interface in your PB code.

            fwiw, I use this dataname.....

            Code:
            LOCAL vParmMissing AS VARIANT
            vParmMissing  = ERROR %DISP_E_PARAMNOTFOUND
            .. because I have often used "optional" params so "vOptParm" is not always the VT_ERROR type.

            Pedantic, yes... but easier for the next poor schmuck who has to maintain your code. You appreciate it a lot when you are your own next poor schmuck and haven't worked on that specific code for a couple of years..

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment

            Working...
            X