Syntax Error in INSERT INTO Statement
-
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# 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# 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; }
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--