Results 1 to 4 of 4

Thread: Working with Recordsets

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Location
    San Diego, CA
    Posts
    159

    Question Working with Recordsets

    Is there a way of dynamically creating full featured recordsets. For example, if I use the ADODC control, I can use Recordcount, AddItem, Update, etc. However, if I create a dynamic recordset on the fly such as

    public sqlTest as string
    public rstTest as New ADODB Recordset

    sqlTest = "Select * from test"
    rstTest.Open sqlTest, strFile, adOpenDynamic
    rstTest.AddNew

    This gives me very limited capabilities. The AddNew isn't available

    Is it that I have an "old" version of the control or is there something else I need.

    Thanking you in advance for your help
    ttfn
    Kicker

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    AddNew is definitely available.

    When you Open a recordset the default lock type is read only.

    Provided everything else is correct, changing the open statement to rstTest.Open sqlTest, strFile, adOpenDynamic, adLockOptimistic will allow you to add new records.

  3. #3
    Member
    Join Date
    Jan 2003
    Location
    London
    Posts
    38
    use the Command object to do this.

    u can then use SQL Insert, Update, create table and delete Queries with this object. if u cannot work it ur self, then post a reply. i will make a small program for u.

    zia.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Location
    San Diego, CA
    Posts
    159
    Thanks:

    Just one more question.....

    With adding the AdLockOptimistic, I can add records just fine now. However, I still can't "change" records that are already in the record set. When I do something like:

    me.rstTest!name = me.txtTest.text
    me.rsttest.updade

    I can see the changes when I cycle through the record set, but it doesn't get written to the actual table for the next time I open a recordset.
    ttfn
    Kicker

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