Insert Record, Retrive Record ID

dneisler

Member
Joined
Sep 6, 2005
Messages
7
Programming Experience
1-3
How would I get the Primary Key ID when I add a new record.

Here is my code sniplet.

Dim sqlCommand As New SqlCommand(mySQL, conn)
sqlCommand.ExecuteNonQuery()

'===================================
'Get Record ID of record created
'===================================
Dim RecordID As Integer
RecordID = 5 ' this would be the database record ID
 
do your data acces sin th modern way and it will happen automatically. Read the DW2 link in my signature, note that 3.0 versions exist too
 
Back
Top