Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB Recordset Addnew Method 1

Status
Not open for further replies.

praveensg

Programmer
May 15, 2002
26
GB
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
 
Praveen,

I also experienced the same problem with "Addnew" method. I don't know why it happened. Later I used the "Insert" query, and everything was fine.

Rohit.
 
how do i insert records using query...I am very new to all this...please help me...
 
praveen,

Do something like this:

first place ADODC control on your form.
Now in the coding section code the following:

---------------------------------------------------------
Dim cn as new ADODB.Connection
Dim rs as new ADODB.Recordset
Dim cmdText as String

cmdText = &quot;Insert into <table name> values (1,'Rohit')&quot;
set cn = New ADODB.Connection
cn.open <details>
Set rs = cn.Execute(cmdText)

-----------------------------------------------------

Regards,
Rohit
 
i am really thankful to u rohit...really im indebted
please send me ur email ID
thanx again
praveen
happy.gif
 
Praveen,

For guidance,
You may contact me at:

rpk_2006@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top