Can anyone tell me how to make a table using SQL with a long which is auto incrimented?
I am making a guestbook that many people can use and admin, so I create a new table for every person that registers.
I want the ID to be a long, and an auto incriment. This will let people admin their guestbook. (I need the id for editing and deleting records)
My current code is:
(I have used guestbook as my example - but it is really my new guys username (as this is in my register.asp))
objConn.Execute "CREATE TABLE [guestbook]" ' create the table
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN [id] INTEGER IDENTITY" 'add the ID field - this should be a long which auto incriments
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN [name] VARCHAR(255) NOT NULL" 'add the name field
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN VARCHAR(255) NOT NULL" 'add the email field
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN [url] VARCHAR(255) NULL" 'add the url field
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN [comment] TEXT NOT NULL" 'add the comment field
objConn.Execute "CREATE INDEX [PrimaryKey] ON [guestbook] (ID)" 'create the primary key
This creates the table fine, and people can submit their comments and view the guestbook ok, but its just the admin that doesnt work properly...
Thanks in advance
Keith
I am making a guestbook that many people can use and admin, so I create a new table for every person that registers.
I want the ID to be a long, and an auto incriment. This will let people admin their guestbook. (I need the id for editing and deleting records)
My current code is:
(I have used guestbook as my example - but it is really my new guys username (as this is in my register.asp))
objConn.Execute "CREATE TABLE [guestbook]" ' create the table
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN [id] INTEGER IDENTITY" 'add the ID field - this should be a long which auto incriments
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN [name] VARCHAR(255) NOT NULL" 'add the name field
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN VARCHAR(255) NOT NULL" 'add the email field
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN [url] VARCHAR(255) NULL" 'add the url field
objConn.Execute "ALTER TABLE [guestbook] ADD COLUMN [comment] TEXT NOT NULL" 'add the comment field
objConn.Execute "CREATE INDEX [PrimaryKey] ON [guestbook] (ID)" 'create the primary key
This creates the table fine, and people can submit their comments and view the guestbook ok, but its just the admin that doesnt work properly...
Thanks in advance
Keith