insert query, autonumber lookup

S

Snuyt

Hello,

I have a insert query in an Access database:

q="INSERT INTO tbl (f1, f2) VALUES ('1', '2')"

the table has 3 fields: id: autonumber, f2: text, f3: text

how do I retrieve the id from this query ?

This is the code I use:

cmd = New OleDb.OleDbCommand(q, MyCon)
MyCon.Open()
cmd.ExecuteNonQuery()


thanks,
Snuyt
 
S

Snuyt

Snuyt said:
Hello,

I have a insert query in an Access database:

q="INSERT INTO tbl (f1, f2) VALUES ('1', '2')"

the table has 3 fields: id: autonumber, f2: text, f3: text

how do I retrieve the id from this query ?

This is the code I use:
to be complete:

Dim MyCon As OleDb.OleDbConnection
Dim cmd As OleDb.OleDbCommand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top