Note that there are some explanatory texts on larger screens.

plurals
  1. PODataAdapter.Update returning syntax error C#
    primarykey
    data
    text
    <pre><code> void updateTaxPayer() { DataRow[] ssnRow = dbSet.Tables["TrackingSheet"].Select("SSN = '" + ssn + "'"); ssnRow[0]["HAS SPOUSE"] = checkboxToString(chkSpouse.CheckState); ssnRow[0]["SPOUSE SSN"] = txtSpouseSSN.Text; ssnRow[0]["TNAME"] = txtName.Text; ssnRow[0]["ADDRESS"] = txtStreetAddress.Text; ssnRow[0]["CITY"] = txtCity.Text; ssnRow[0]["STATE"] = cbxState.SelectedIndex.ToString(); ssnRow[0]["ZIP"] = txtZip.Text; ssnRow[0]["HAS NEW ADDRESS"] = checkboxToString(chkNewAddress.CheckState); ssnRow[0]["NEW ADDRESS"] = txtNewAddress.Text; ssnRow[0]["NEW CITY"] = txtNewCity.Text; ssnRow[0]["NEW STATE"] = cbxNewState.SelectedIndex.ToString(); ssnRow[0]["NEW ZIP"] = txtNewZip.Text; ssnRow[0]["DATE FILED"] = txtDate.Text; ssnRow[0]["SSN"] = txtSSN.Text; dbAdapt.InsertCommand = cmdBuilder.GetInsertCommand(true); dbAdapt.UpdateCommand = cmdBuilder.GetUpdateCommand(true); dbAdapt.DeleteCommand = cmdBuilder.GetDeleteCommand(true); dbAdapt.Update(dbSet,"TrackingSheet"); } </code></pre> <p>Above is the code that i have to update my database, but for some reason when i try to update I get a syntax error for the update command. I've searched around and i'm not sure what to do.</p> <p>I've also tried dbAdapt.Update(dbSet, "TrackingSheet"); and that didn't work either.</p> <p>The exact error is: </p> <pre><code>System.Data.OleDb.OleDbException (0x80040E14): Syntax error in UPDATE statement. at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount) at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at trackingform.frmTrackingSheet.updateTaxPayer() in c:\Users\Anthony\Documents\Visual Studio 2012\Projects\trackingform\trackingform\frmTrackingSheet.cs:line 595 at trackingform.frmTrackingSheet.btnSave_Click(Object sender, EventArgs e) in c:\Users\Anthony\Documents\Visual Studio 2012\Projects\trackingform\trackingform\frmTrackingSheet.cs:line 506 </code></pre> <p>Line 595: dbAdapt.Update(dbSet,"TrackingSheet"); Line 506: updateTaxPayer();</p> <p>Other declarations:</p> <pre><code>dbAdapt = new OleDbDataAdapter(); cmdBuilder = new OleDbCommandBuilder(dbAdapt); dbAdapt.SelectCommand = dbCmd; dbSet = new DataSet("TrackingSheet"); dbAdapt.Fill(dbSet, "TrackingSheet"); </code></pre> <p>Anyone have any ideas? Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload