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. Database & SysAdmin
  3. Database
  4. Syntax Error in INSERT INTO Statement

Syntax Error in INSERT INTO Statement

Scheduled Pinned Locked Moved Database
csharpdatabasehelplearning
3 Posts 2 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.
  • C Offline
    C Offline
    Cfer83
    wrote on last edited by
    #1

    C# And Access DB. There is an Autonumber field in the table, 'PP_WF_ID'. Every field is Text Type except Personnel_Id And Company_Id bool InsertWorkFlowPP() { if (Sel.IsAuthenticated()) { try { using (OleDbConnection myconn = new OleDbConnection()) { OleDbCommand mycomm; string sSQL = "INSERT INTO PP_WF(Personnel_ID,Photo_Location,pp_Name,Position,"; sSQL += "Highlights,Education,Projects,"; sSQL += "Full_Description,Summary,Company_ID,WF_STATUS,Is_CEO)"; sSQL += " VALUES(@Personnel_ID,@Photo_Location,@pp_Name,@Position,"; sSQL += "@Highlights,@Education,@Projects,@Full_Description,@Summary,@Company_ID,@WF_STATUS,@Is_CEO);"; myconn.ConnectionString = ConfigHelper.GetWFString(); mycomm = new OleDbCommand(sSQL, myconn); mycomm.Parameters.AddWithValue("@Personnel_ID", System.Convert.ToInt32(Labelcode.Text)); mycomm.Parameters.AddWithValue("@Photo_Location", picture.ImageUrl); mycomm.Parameters.AddWithValue("@pp_Name", name.Text.Trim()); mycomm.Parameters.AddWithValue("@Position", position.Text.Trim()); mycomm.Parameters.AddWithValue("@Highlights", highlights.Text.Trim()); mycomm.Parameters.AddWithValue("@Education", education.Text.Trim()); mycomm.Parameters.AddWithValue("@Projects", projects.Text.Trim()); mycomm.Parameters.AddWithValue("@Full_Description", longbio.Text.Trim()); mycomm.Parameters.AddWithValue("@Summary", shortbio.Text.Trim()); mycomm.Parameters.AddWithValue("@Company_Id",Sel.GetCookies("Company_id")); mycomm.Parameters.AddWithValue("@WF_STATUS", "NA"); mycomm.Parameters.AddWithValue("@is_CEO", chkCEO.Checked.ToString()); myconn.Open(); mycomm.ExecuteNonQuery(); return true; } } catch (Exception) { } finally { } } return false; }

    C S 2 Replies Last reply
    0
    • C Cfer83

      C# And Access DB. There is an Autonumber field in the table, 'PP_WF_ID'. Every field is Text Type except Personnel_Id And Company_Id bool InsertWorkFlowPP() { if (Sel.IsAuthenticated()) { try { using (OleDbConnection myconn = new OleDbConnection()) { OleDbCommand mycomm; string sSQL = "INSERT INTO PP_WF(Personnel_ID,Photo_Location,pp_Name,Position,"; sSQL += "Highlights,Education,Projects,"; sSQL += "Full_Description,Summary,Company_ID,WF_STATUS,Is_CEO)"; sSQL += " VALUES(@Personnel_ID,@Photo_Location,@pp_Name,@Position,"; sSQL += "@Highlights,@Education,@Projects,@Full_Description,@Summary,@Company_ID,@WF_STATUS,@Is_CEO);"; myconn.ConnectionString = ConfigHelper.GetWFString(); mycomm = new OleDbCommand(sSQL, myconn); mycomm.Parameters.AddWithValue("@Personnel_ID", System.Convert.ToInt32(Labelcode.Text)); mycomm.Parameters.AddWithValue("@Photo_Location", picture.ImageUrl); mycomm.Parameters.AddWithValue("@pp_Name", name.Text.Trim()); mycomm.Parameters.AddWithValue("@Position", position.Text.Trim()); mycomm.Parameters.AddWithValue("@Highlights", highlights.Text.Trim()); mycomm.Parameters.AddWithValue("@Education", education.Text.Trim()); mycomm.Parameters.AddWithValue("@Projects", projects.Text.Trim()); mycomm.Parameters.AddWithValue("@Full_Description", longbio.Text.Trim()); mycomm.Parameters.AddWithValue("@Summary", shortbio.Text.Trim()); mycomm.Parameters.AddWithValue("@Company_Id",Sel.GetCookies("Company_id")); mycomm.Parameters.AddWithValue("@WF_STATUS", "NA"); mycomm.Parameters.AddWithValue("@is_CEO", chkCEO.Checked.ToString()); myconn.Open(); mycomm.ExecuteNonQuery(); return true; } } catch (Exception) { } finally { } } return false; }

      C Offline
      C Offline
      Cfer83
      wrote on last edited by
      #2

      Can someone move this to the ASP.NET Category perhaps? I would like to solve this today, thanks.

      1 Reply Last reply
      0
      • C Cfer83

        C# And Access DB. There is an Autonumber field in the table, 'PP_WF_ID'. Every field is Text Type except Personnel_Id And Company_Id bool InsertWorkFlowPP() { if (Sel.IsAuthenticated()) { try { using (OleDbConnection myconn = new OleDbConnection()) { OleDbCommand mycomm; string sSQL = "INSERT INTO PP_WF(Personnel_ID,Photo_Location,pp_Name,Position,"; sSQL += "Highlights,Education,Projects,"; sSQL += "Full_Description,Summary,Company_ID,WF_STATUS,Is_CEO)"; sSQL += " VALUES(@Personnel_ID,@Photo_Location,@pp_Name,@Position,"; sSQL += "@Highlights,@Education,@Projects,@Full_Description,@Summary,@Company_ID,@WF_STATUS,@Is_CEO);"; myconn.ConnectionString = ConfigHelper.GetWFString(); mycomm = new OleDbCommand(sSQL, myconn); mycomm.Parameters.AddWithValue("@Personnel_ID", System.Convert.ToInt32(Labelcode.Text)); mycomm.Parameters.AddWithValue("@Photo_Location", picture.ImageUrl); mycomm.Parameters.AddWithValue("@pp_Name", name.Text.Trim()); mycomm.Parameters.AddWithValue("@Position", position.Text.Trim()); mycomm.Parameters.AddWithValue("@Highlights", highlights.Text.Trim()); mycomm.Parameters.AddWithValue("@Education", education.Text.Trim()); mycomm.Parameters.AddWithValue("@Projects", projects.Text.Trim()); mycomm.Parameters.AddWithValue("@Full_Description", longbio.Text.Trim()); mycomm.Parameters.AddWithValue("@Summary", shortbio.Text.Trim()); mycomm.Parameters.AddWithValue("@Company_Id",Sel.GetCookies("Company_id")); mycomm.Parameters.AddWithValue("@WF_STATUS", "NA"); mycomm.Parameters.AddWithValue("@is_CEO", chkCEO.Checked.ToString()); myconn.Open(); mycomm.ExecuteNonQuery(); return true; } } catch (Exception) { } finally { } } return false; }

        S Offline
        S Offline
        sidbaruah
        wrote on last edited by
        #3

        In this << "@Highlights,@Education,@Projects,@Full_Description,@Summary,@Company_ID,@WF_STATUS,@Is_CEO)(this one here) ;"; >> Wat is the ;(semicolon) doing just before this << "; >> I guess you need to remove that!!!

        I was born dumb!! :laugh:Programming made me laugh:laugh:!!! --sid--

        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