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. Web Development
  3. ASP.NET
  4. Error: "Missing semicolon (;) at end of SQL statement"

Error: "Missing semicolon (;) at end of SQL statement"

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestionmysql
4 Posts 4 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.
  • A Offline
    A Offline
    amit_mi
    wrote on last edited by
    #1

    I have 2 Tables: Subscribers and Interests. Both have an Email ID column. I would like to set the Email ID of Subscribers = that of the Email ID column of Interests. Now when i executethe SQL Query as: String MySQL = "INSERT INTO Interests (Financial, Computer, Distribution) VALUES ('" + cb1 + "', '" + cb2 + "', '" + cb3 + "')" + "SELECT Email FROM Subscriber" + ";'"; it gives me an error message as: "Missing semicolon (;) at end of SQL statement." What is the possible solution ? Thanks very much for the help.

    E R G 3 Replies Last reply
    0
    • A amit_mi

      I have 2 Tables: Subscribers and Interests. Both have an Email ID column. I would like to set the Email ID of Subscribers = that of the Email ID column of Interests. Now when i executethe SQL Query as: String MySQL = "INSERT INTO Interests (Financial, Computer, Distribution) VALUES ('" + cb1 + "', '" + cb2 + "', '" + cb3 + "')" + "SELECT Email FROM Subscriber" + ";'"; it gives me an error message as: "Missing semicolon (;) at end of SQL statement." What is the possible solution ? Thanks very much for the help.

      E Offline
      E Offline
      enjoycrack
      wrote on last edited by
      #2

      hi there, I'm wondering some things on this: - the SQL query u gaved out does not relate to ur purpose amit_mi wrote: I would like to set the Email ID of Subscribers = that of the Email ID column of Interests. - just glance at ur query, I think u want to combine 2 queries into one. if so, there is a syntax error. the correct one should be (add the semicolon at the end of the first query): String MySQL = "INSERT INTO Interests (Financial, Computer, Distribution) VALUES ('" + cb1 + "', '" + cb2 + "', '" + cb3 + "');" + "SELECT Email FROM Subscriber" + ";'"; << >>

      1 Reply Last reply
      0
      • A amit_mi

        I have 2 Tables: Subscribers and Interests. Both have an Email ID column. I would like to set the Email ID of Subscribers = that of the Email ID column of Interests. Now when i executethe SQL Query as: String MySQL = "INSERT INTO Interests (Financial, Computer, Distribution) VALUES ('" + cb1 + "', '" + cb2 + "', '" + cb3 + "')" + "SELECT Email FROM Subscriber" + ";'"; it gives me an error message as: "Missing semicolon (;) at end of SQL statement." What is the possible solution ? Thanks very much for the help.

        R Offline
        R Offline
        Rahul Walavalkar
        wrote on last edited by
        #3

        Try putting a semicolon after the insert statement as well. (Before the select statement.) About your sql query, let me get this correct. You want to set the email id of Subscribers the same as that in Interests. Right? And what are you trying to do in the SQL statement? Are you inserting in the Interests table? And what does the Select statement do then? If it is fetching email from the subscriber table to be inserted in the Interests table, then where is the email target field in the insert statement? Little Johnny was a scientist. Little Johnny is no more. For what he thought was H2O, turned out to be H2SO4.

        1 Reply Last reply
        0
        • A amit_mi

          I have 2 Tables: Subscribers and Interests. Both have an Email ID column. I would like to set the Email ID of Subscribers = that of the Email ID column of Interests. Now when i executethe SQL Query as: String MySQL = "INSERT INTO Interests (Financial, Computer, Distribution) VALUES ('" + cb1 + "', '" + cb2 + "', '" + cb3 + "')" + "SELECT Email FROM Subscriber" + ";'"; it gives me an error message as: "Missing semicolon (;) at end of SQL statement." What is the possible solution ? Thanks very much for the help.

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Are you trying to get the value from the Subscriber table, and insert it in the Interets table? Then you should have the select instead of the values: "insert into Interests (Financial, Computer, Distribution, Email) select '" + cb1 + "', '" + cb2 + "', '" + cb3 + "', Email FROM Subscriber" If you have more than one record in the subscriber table, you might want to specify what subsciber you want to use, or you will insert one record in the Interests table for each subscriber. --- b { font-weight: normal; }

          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