-
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
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks