Hello All:
I have a button in my windows forms which UPDATES every table. However, I am getting error SQLException was unhandled. Incorrect syntax near '='.
This is my code in Update Button:
I have a button in my windows forms which UPDATES every table. However, I am getting error SQLException was unhandled. Incorrect syntax near '='.
This is my code in Update Button:
Code:
var sql = new StringBuilder();
sql.AppendLine("UPDATE dbo.JobStatus");
sql.AppendLine("Set ShipTrackingNumber = @ShipTrackingNumber");
sql.AppendLine(", ShipMethodTransmitted = @ShipMethodTransmitted");
sql.AppendLine(", DateShipTransmitProcessed = @DateShipTransmitProcessed");
sql.AppendLine(", ShipmentProcessedBy = @ShipmentProcessedBy");
sql.AppendLine(", Critical = @Critical");
sql.AppendLine(", ShipTransmitStatus = @ShipTransmitStatus");
sql.AppendLine("Where jobtableId = @jobTableId");
cmd.Connection = sqlConnection1;
cmd.CommandText = sql.ToString();
cmd.Parameters.AddWithValue("@TrackingNumber", row.Cells[7].FormattedValue);
cmd.Parameters.AddWithValue("@ShipMethodTransmitted", row.Cells[8].FormattedValue);
cmd.Parameters.AddWithValue("@DateShipTransmitProcessed", row.Cells[9].FormattedValue);
cmd.Parameters.AddWithValue("@ShipmentProcessedBy", row.Cells[10].FormattedValue);
cmd.Parameters.AddWithValue("@Critical", row.Cells[11].FormattedValue);
cmd.Parameters.AddWithValue("@ShipTransmitStatus", row.Cells[13].FormattedValue);
cmd.Parameters.AddWithValue("@jobTableId", row.Cells[5].FormattedValue);
Comment