Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Invalid SQL Statement

Invalid SQL Statement

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestionannouncement
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sarah_chandran
    wrote on last edited by
    #1

    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

    K S 2 Replies Last reply
    0
    • S sarah_chandran

      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

      K Offline
      K Offline
      KaptinKrunch
      wrote on last edited by
      #2

      Take a look at this page on MSDN. http://support.microsoft.com/default.aspx?scid=kb;en-us;325698[^]

      S 1 Reply Last reply
      0
      • S sarah_chandran

        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

        S Offline
        S Offline
        Scott Serl
        wrote on last edited by
        #3

        If the database is SQL Server, then 'Number' is not a valid data type (use INT), otherwise, I don't know the answer.

        S 1 Reply Last reply
        0
        • K KaptinKrunch

          Take a look at this page on MSDN. http://support.microsoft.com/default.aspx?scid=kb;en-us;325698[^]

          S Offline
          S Offline
          sarah_chandran
          wrote on last edited by
          #4

          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

          S 1 Reply Last reply
          0
          • S Scott Serl

            If the database is SQL Server, then 'Number' is not a valid data type (use INT), otherwise, I don't know the answer.

            S Offline
            S Offline
            sarah_chandran
            wrote on last edited by
            #5

            Thanks for taking the time to answer my query. I am using MS-Access not sql.

            K 1 Reply Last reply
            0
            • S sarah_chandran

              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

              S Offline
              S Offline
              Scott Serl
              wrote on last edited by
              #6

              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[^]

              1 Reply Last reply
              0
              • S sarah_chandran

                Thanks for taking the time to answer my query. I am using MS-Access not sql.

                K Offline
                K Offline
                KaptinKrunch
                wrote on last edited by
                #7

                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.

                S 1 Reply Last reply
                0
                • K KaptinKrunch

                  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.

                  S Offline
                  S Offline
                  sarah_chandran
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups