Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Naming a database table with dynamic variable

Posted 10 Sep 2004 07:01:42
1
has voted
10 Sep 2004 07:01:42 Ted Chukere posted:
I need help with using form variable to name database table created in Access using a SQL statement as follows:

pgName=Request.Form("txtPgName"

strSQL="Create table" & pgName & "(paraID COUNTER primary key, pgName Text, paraHdr Text, paraCopy Text)"

When I run it, I get the following error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in CREATE TABLE statement.

Can you help me?

Thanks,

Ted Chukere, CIW

ted

Replies

Replied 21 Sep 2004 19:49:32
21 Sep 2004 19:49:32 Ted Chukere replied:
Change this line: strSQL="Create table" & pgName & "(paraID COUNTER primary key, pgName Text, paraHdr Text, paraCopy Text)"
To:
strSQL="Create table" &" " & pgName & "(paraID COUNTER primary key, pgName Text, paraHdr Text, paraCopy Text)"

Thats all you need to do; your problem is there is no space between Create table and pgName.

ted

Reply to this topic