Results 1 to 5 of 5

Thread: [RESOLVED] Query result container not for display

  1. #1

    Thread Starter
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Resolved [RESOLVED] Query result container not for display

    Hi All,

    Here's the problem : I'am building a vb6 application that uses a .dll wrapper for sqlite to access two sqlite database. My query results (SELECT) are returned in a Variant variable. I would like to add my result to an organized object like a recordset or a datagrid BUT I dont want to display the results. I am building a class not a form, so what I'm really looking for is an object in wich I could initiate columns with proper column name and then add my data rows. That way I will be able to browse my result using the row index and the field name.

    Is there an unbound object that doesn't have to be on a form that I could use?

    thanks a lot for your help

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Query result container not for display

    Welcome to VBForums

    Thread moved to Database Development forum

    The Recordset object is not bound at all - I suspect that you have been using a Data Control of some sort, perhaps the DAO one (default name of 'Data1') or the ADO one (default name of 'ADODC1'), both of which include a Recordset.

    In the "ADO Tutorial" link in my signature is an explanation/example of how to use a Recordset without binding - there is code to show the data, but you can change that to whatever you like.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Query result container not for display

    As far as display the data, you would need some kind of control, and that control would have to reside on a form.

    Wouldn't even a bound data control need to reside on a form?

  4. #4

    Thread Starter
    Fanatic Member stlaural's Avatar
    Join Date
    Sep 2007
    Location
    Quebec, Canada
    Posts
    683

    Re: Query result container not for display

    thanks for the tutorial, but I still see a problem. the recordset needs a connection to a database to get the structure of the table and I don't have any connection object as I am using a .dll wrapper to connect to the sqlite database. So in order to use the recordset I need to be able to give the recordset the proper structure, I would need something like : rs.addheaders("field1", "field2"). then I would be able to use the AddNew method.

    I hope this is clearer.

    thanks for helping

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Query result container not for display

    I would need something like : rs.addheaders("field1", "field2"). then I would be able to use the AddNew method.
    You can create an in-memory recordset using the Fields.Append method

    Code:
    Dim rs as ADODB.Recordset
    Set rs = New ADODB.Recordset
    rs.Fields.Append "Field1", adInteger
    rs.Fields.Append "Field1", advarchar, 30
    rs.Open
    rs.AddNew...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width