0

I have a program that creates a SQL statement based upon a treeview list that the user makes. The SQL statement looks like this:

CREATE TABLE Test ( Test ID PRIMARY KEY, Check1 CHAR(255), Check2 MEMO, Check3 INTEGER, Check4 DOUBLE, Check5 DATETIME, Check6 BOOLEAN) VALUES (1, 'DefSML', 'DefLRG', 0, 0.0, '3/7/2008 12:00:00 AM', 'True');

but I continually get a Syntax error - when I check it with a validator it is on the DOUBLE variable. The VB error that i get is System.Data.OleDB.OleDBException: Syntax error in field definition. Which is why I think it is my SQL that is messed up - any help is appreciated. Thanks

2
Contributors
1
Reply
4
Views
9 Years
Discussion Span
Last Post by Kegtapper
0

I have a program that creates a SQL statement based upon a treeview list that the user makes. The SQL statement looks like this:

CREATE TABLE Test ( Test ID PRIMARY KEY, Check1 CHAR(255), Check2 MEMO, Check3 INTEGER, Check4 DOUBLE, Check5 DATETIME, Check6 BOOLEAN) VALUES (1, 'DefSML', 'DefLRG', 0, 0.0, '3/7/2008 12:00:00 AM', 'True');

but I continually get a Syntax error - when I check it with a validator it is on the DOUBLE variable. The VB error that i get is System.Data.OleDB.OleDBException: Syntax error in field definition. Which is why I think it is my SQL that is messed up - any help is appreciated. Thanks

I dont think you can use the VALUES statement at the same time as CREATE in ACCESS.

  1. Field Name has space (causes problems later)
  2. The int specifier is missing for the Primary Key
  3. Then BOOLEAN specifier not valid - use YESNO

But corrected as...
CREATE TABLE Test (TestID int PRIMARY KEY, Check1 CHAR(255), Check2 MEMO, Check3 INTEGER, Check4 DOUBLE, Check5 DATETIME, Check6 YESNO);

should work, then use an INSERT statement for the first record.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.