Syntax error in INSERT INTO statement.

Results 1 to 2 of 2

Thread: Syntax error in INSERT INTO statement.

  1. #1
    Join Date
    Dec 1969

    Default Syntax error in INSERT INTO statement.

    string strConnection = ConnectionString();<BR> OleDbConnection objConnection = new OleDbConnection(strConnection);<BR> <BR> string strAddEmployeeSQL = "SELECT * FROM OrgEmployee";<BR> DataSet objDataSet = new DataSet();<BR> OleDbDataAdapter objAdapter = new OleDbDataAdapter(strAddEmployeeSQL, objConnection);<BR> objAdapter.Fill(objDataSet, "OrgEmployee");<BR> <BR> DataTable objTable;<BR> DataRow objNewRow;<BR> <BR> objTable = objDataSet.Tables["OrgEmployee"];<BR> objNewRow = objTable.NewRow();<BR> objNewRow["FEID"] = Request.Cookies["PayOut"]["FEID"];<BR> objNewRow["SSN"] = Request.Form["SSN"];<BR> objNewRow["LName"] = Request.Form["LastName"];<BR> objNewRow["FName"] = Request.Form["FirstName"];<BR> objNewRow["MName"] = Request.Form["MiddleName"];<BR>objTable.Rows.Add(objNewRow);<BR> <BR> OleDbCommandBuilder objBuilder = new OleDbCommandBuilder(objAdapter);<BR> objAdapter.UpdateCommand = objBuilder.GetUpdateCommand();<BR> objAdapter.InsertCommand = objBuilder.GetInsertCommand();<BR> objAdapter.DeleteCommand = objBuilder.GetDeleteCommand();<BR> objAdapter.Update(objDataSet, "OrgEmployee");<BR><BR>I get an error that says: Syntax error in INSERT INTO statement.<BR>So my question is how do I view the SQL statement or how can I figure out what field is giving me the truble?<BR><BR>I have alot of fields othere then the few I am showing so I want to know what one is having problems updating.<BR><BR>Thanks - This is a major help

  2. #2
    Join Date
    Dec 1969

    Default RE: Syntax error in INSERT INTO statement.

    If you have Debug = "True" on your aspx page<BR><BR>&#060;%@ Page Language="VB" EnableViewState = "True" Debug="True"%&#062;<BR><BR>you should get a decent error message which may help.<BR><BR>I don&#039;t know of a way to pinpoint the exact field that is giving the problem. Even stepping through the code in VB.Net isn&#039;t likely to show it.<BR><BR>There is a debugger capability with the SDK, but it&#039;s a pain to use and I don&#039;t think it will give you much more info.<BR><BR>Other than placing a prefix on each field (such as r ) I don&#039;t know of an easy way to pinpoint a field name that is a violation of reserved words.<BR><BR>Sorry,<BR><BR>TT

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts