OleDbAdapter.InsertCommand and autoincrement IDs problem

G

Guest

I use OleDbAdapter to fill my dataset from Access database and tables with autoincrement id columns.Also i created xsd schema for my dataset

The problem is that the dataset automatically add neu unique ID which is not correspond to realy added record ID in the database
For exp. in database i have
ID Name Titl
10 john some tex
12 peter .......


ds.Table1Row newrow=ds.Table1.NewTable1Row(
newRow.Name = some name
newRow.Title = some new title
..
ds.Table1.AddTable1Row(newRow)
oledbAdapter1.Update(ds.Table1)
In this moment Dataset automatically add ID = 13 for the new record, which is not correct, in case some others records are deleted before in database after record with ID 12
My question is it possible to write InsertCommand like in SqlAdapter insert command
in one sentence Insert and Select clause included select @@IDENTITY and returns correct ID
Thanks for any help.
 

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