Thursday, 15 July 2010

c# - INSERT command for auto increment field in access from asp.net website -



c# - INSERT command for auto increment field in access from asp.net website -

i've got primary key set auto increment in access database.

how specify want primary key have next available value?

e.g.

oledbcommand cmd = new oledbcommand("insert table values (?,"string","string");", conn);

thanks!

if have table such:

table

id somestring somestring2

where id primary key, you'd not need specify value primary key. "auto-incremented" have specified that.

so you'd enter:

oledbcommand cmd = new oledbcommand("insert table (somestring, somestring2) values ('stringa','stringb')", conn);

note: its practice mention column names when performing insertion of records.

hope helps!!!

c# sql asp-classic

No comments:

Post a Comment