Invalid SQL Statement
-
Hi, Can i create tables from vb6? I tried it but i get this error if i use the provider- Jet 3.51 (for MS-Access) , if i use Jet 4.0 i do not get this error. So does the syntax change when i use Jet 3.51? ERROR: "Invalid SQL statement, expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT' , or 'UPDATE'." Alter,Update,Delete,Insert etc. work in Jet 3.51, only Create gives this error. Can anyone tell me the syntax for create table in vb6 using Provider 3.51? Right now my code reads like this; sSql="CREATE TABLE Tab1(ID Number,Age Number)" gCon.Execute sSql Thanks in advance, Sarah -- modified at 23:57 Wednesday 30th November, 2005
-
Hi, Can i create tables from vb6? I tried it but i get this error if i use the provider- Jet 3.51 (for MS-Access) , if i use Jet 4.0 i do not get this error. So does the syntax change when i use Jet 3.51? ERROR: "Invalid SQL statement, expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT' , or 'UPDATE'." Alter,Update,Delete,Insert etc. work in Jet 3.51, only Create gives this error. Can anyone tell me the syntax for create table in vb6 using Provider 3.51? Right now my code reads like this; sSql="CREATE TABLE Tab1(ID Number,Age Number)" gCon.Execute sSql Thanks in advance, Sarah -- modified at 23:57 Wednesday 30th November, 2005
Take a look at this page on MSDN. http://support.microsoft.com/default.aspx?scid=kb;en-us;325698[^]
-
Hi, Can i create tables from vb6? I tried it but i get this error if i use the provider- Jet 3.51 (for MS-Access) , if i use Jet 4.0 i do not get this error. So does the syntax change when i use Jet 3.51? ERROR: "Invalid SQL statement, expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT' , or 'UPDATE'." Alter,Update,Delete,Insert etc. work in Jet 3.51, only Create gives this error. Can anyone tell me the syntax for create table in vb6 using Provider 3.51? Right now my code reads like this; sSql="CREATE TABLE Tab1(ID Number,Age Number)" gCon.Execute sSql Thanks in advance, Sarah -- modified at 23:57 Wednesday 30th November, 2005
If the database is SQL Server, then 'Number' is not a valid data type (use INT), otherwise, I don't know the answer.
-
Take a look at this page on MSDN. http://support.microsoft.com/default.aspx?scid=kb;en-us;325698[^]
Thanks for taking the time to answer my query. I am coding in VB6 so i am thinking if the .net site would help me but i will give it a try. Thanks again. I get the error only if i use Jet 3.51 provider , I do not get it if i user Jet 4.0 provider,but i need it to work with Jet 3.51. So please help if u know what is wrong with my syntax. -- modified at 5:26 Thursday 1st December, 2005
-
If the database is SQL Server, then 'Number' is not a valid data type (use INT), otherwise, I don't know the answer.
Thanks for taking the time to answer my query. I am using MS-Access not sql.
-
Thanks for taking the time to answer my query. I am coding in VB6 so i am thinking if the .net site would help me but i will give it a try. Thanks again. I get the error only if i use Jet 3.51 provider , I do not get it if i user Jet 4.0 provider,but i need it to work with Jet 3.51. So please help if u know what is wrong with my syntax. -- modified at 5:26 Thursday 1st December, 2005
You might have to use ADOX back in the jet3.51 environment to do any DDL type stuf. I haven't used it since about 1997, so I forget. ADOX Documentation on MSDN[^]
-
Thanks for taking the time to answer my query. I am using MS-Access not sql.
The best thing to do is create a stored procedure that creates the table you need. Then from your code you can execute that stored procedure and have the table created. The caution I stress is that it should be a one time deal unless you do a check to see if the table currents exists or your perform a drop table first in the SP.
-
The best thing to do is create a stored procedure that creates the table you need. Then from your code you can execute that stored procedure and have the table created. The caution I stress is that it should be a one time deal unless you do a check to see if the table currents exists or your perform a drop table first in the SP.
I have used this driver instead of Jet 3.51 DRIVER={Microsoft Access Driver (*.mdb)};DBQ= and it is working now (My boss says it's alright to use this driver in our project) Thanks Scott and KaptinKrunch for ur help. -- modified at 7:11 Tuesday 6th December, 2005