Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: how to create a table with autonumber and primary key?


Message #1 by "janet" <janet_smith2000@y...> on Mon, 19 Mar 2001 09:31:14
i use Access2000

my sql statement is like this

strSQL = "CREATE TABLE Janet ([ID] LONG PRIMARY KEY, [NAME] 

VARCHAR(50));"

objRS.Open strSQL, objConn



after execute,

i want to insert data:

strSQL = "INSERT INTO Janet([NAME]) VALUES('Smith');"

objRS.Open strSQL, objConn



then a message was appeared:

primary key [ID] cann't contain null value.



i thought primary key field is autonumber automatically.



my question is:

how do we create a autonumber field in primary key?

thanks in advance


  Return to Index