ADO Data Control Recordset problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: ADO Data Control Recordset problem

  1. #1
    praveen Guest

    ADO Data Control Recordset problem


    hi there
    i have two ADODB controls and i have connected them to two tables respectively....

    actually i might sound stupid but this is really bothering me....

    what i am doing is adding a record to table1 and also to table2 simultaneously
    thru' these two ADODBs...using the addnew method...

    the problem is that...
    records get added very well in both the databases till 14 records...
    then the 15th record is getting added in the first place in the second recordset
    not the last position....

    the table when opened looks fine....but when i access the recordset...it
    starts from record 15 (i mean the one i inserted after 14) instead of the
    first one...the first one comes one position down....

    my code for the second recordset looks like this

    Adodc2.Refresh
    Adodc2.Recordset.AddNew
    Adodc2.Recordset.Fields(0) = Adodc1.Recordset.Fields(0)
    Adodc2.Recordset.Fields(1) = Str(Adodc1.Recordset.Fields(0).Value)
    Adodc2.Recordset.Update

    please help me as this is really important for me


  2. #2
    jb Guest

    Re: ADO Data Control Recordset problem


    "praveen" <praveensg2000@yahoo.com> wrote:
    >
    >hi there
    >i have two ADODB controls and i have connected them to two tables respectively....
    >
    >actually i might sound stupid but this is really bothering me....
    >
    >what i am doing is adding a record to table1 and also to table2 simultaneously
    >thru' these two ADODBs...using the addnew method...
    >
    >the problem is that...
    >records get added very well in both the databases till 14 records...
    >then the 15th record is getting added in the first place in the second recordset
    >not the last position....
    >
    >the table when opened looks fine....but when i access the recordset...it
    >starts from record 15 (i mean the one i inserted after 14) instead of the
    >first one...the first one comes one position down....
    >
    >my code for the second recordset looks like this
    >
    >Adodc2.Refresh
    >Adodc2.Recordset.AddNew
    >Adodc2.Recordset.Fields(0) = Adodc1.Recordset.Fields(0)
    >Adodc2.Recordset.Fields(1) = Str(Adodc1.Recordset.Fields(0).Value)
    >Adodc2.Recordset.Update
    >
    >please help me as this is really important for me
    >

    '***********************
    You might want to try 2 seperate recordsets with 2 seperate addnews.
    example:

    Adodc1.recordset.addnew

    adodc1.fields(0).value = "Value you want" ' Can be textbox values.
    adodc1.fields(1).value = "Value you want"

    Adodc1.recordset.update

    Adodc2.recordset.addnew

    adodc2.fields(0).value = "Value you want"
    adodc2.fields(1).value = "Value you want"

    Adodc2.recordset.update

    'This may not be the best way, but it works..!!! This will just keep adding.........
    I just did it and it worked. Hope this helps.

    jb



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center