Guest_imported
New member
- Jan 1, 1970
- 0
Hi All,
I want to create an Access table using SQL command.
The table include an AUTOINCREMENT field and a field with foreign key.
These two fields' datatype is Long, but I don't know how to define AUTOINCREMENT and a foreign key.
My SQL like:
strSql="Create table " & tab_name &_
"(" &_
"msgId Long AUTOINCREMENT Primary Key Not Null, " &_
"parentId Long Foreign Key Not Null, " &_
"
"
Set adoConn = Server.CreateObject("ADODB.Connection"
adoConn.Open "Driver={Microsoft Access Driver (*.mdb)};" &_
"dbq=" & Server.MapPath("MyDB.mdb"
set adoRs = adoConn.execute(strSql)
It runs error. Can anyone know how to make the SQL command?
Thanks in advanced
Lianbo
I want to create an Access table using SQL command.
The table include an AUTOINCREMENT field and a field with foreign key.
These two fields' datatype is Long, but I don't know how to define AUTOINCREMENT and a foreign key.
My SQL like:
strSql="Create table " & tab_name &_
"(" &_
"msgId Long AUTOINCREMENT Primary Key Not Null, " &_
"parentId Long Foreign Key Not Null, " &_
"
Set adoConn = Server.CreateObject("ADODB.Connection"
adoConn.Open "Driver={Microsoft Access Driver (*.mdb)};" &_
"dbq=" & Server.MapPath("MyDB.mdb"
set adoRs = adoConn.execute(strSql)
It runs error. Can anyone know how to make the SQL command?
Thanks in advanced
Lianbo