Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Retrieve autonumbers in ASP.NET


Message #1 by "Anup Raghoebarsing" <araghoebarsing@x...> on Sun, 14 Jul 2002 04:05:05
With ASP I used to retrieve autonumbers of my primary field in the 
following way:

Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open DEF_connection
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open tablename, Connection, adOpenKeySet, adLockOptimistic, adCmdTable
RS.AddNew

insertedID = RS("ID") ' get ID *before* the update call
		
'insert in table 1
RS.Close
set rs = nothing

'insert in table 2
sql = "insert into tbl2 (IDfield,field1,field2) Values 
(insertedID,value1,value2)"
connection.execute(sql)

Now with ASP.NET and DataSet, I'm not so sure how to retrieve the 
autonumber value of my Access (parent) tables and insert this in one or 
more child tables.

Can anyone help me with this one?

  Return to Index