Inserting Data in Access Database from ASP/C# Web Form

May 24, 2013 in answer

0 votes, 0.00 avg. rating (0% score)

ANSWER:

To make sure you have the correct identity it is better to call IDENT_CURRENT(‘TableName’)

DbCommand comm2 = conn.CreateCommand();
comm2.CommandText = "Select IDENT_CURRENT('userinfo')";
comm2.Connection = conn;

String id = comm2.ExecuteScalar().ToString();
conn.Close();

Please see Here for an explanation.

Nico de Wit from http://stackoverflow.com/questions/16734818