Note that there are some explanatory texts on larger screens.

plurals
  1. POPlease help figure out what's wrong with this database update statement from text boxes in C#
    text
    copied!<pre><code>comm.CommandText = "UPDATE studbiodata([Registration Number], Surname, Othernames, Email," + " Phone, Address, Sex, [Birth Date], Religion, [Marital Status]," + " [No. of Children], [Next of Kin], Relationship, [Next of Kin Address])" + "SET ([Registration Number] ='" + txtRegNo.Text + "', Surname = '" + txtSurname.Text + "', Othernames = '" + txtOthernames.Text + "', Email = '" + txtEmail.Text + "', Phone = '" + txtPhone.Text + "', Address = '" + txtMainAdd.Text + "', Sex = '" + txtSex.Text + "', [Birth Date]= '" + txtBirthDate.Text + "', Religion = '" + txtReligion.Text + "', [Marital Status]= '" + txtMarital.Text + "', [No.of Children] = '" + txtChildren.Text + "', [Next of Kin]= '" + txtKin.Text + "', Relationship ='" + txtRelationship.Text + "', [Next of Kin Address]= '" + txtKinAdd.Text + "' WHERE [Registration Number]= '" + txtRegNo.Text + "')"; </code></pre> <p>The error message I get after trying to update from a web-form is:</p> <pre> System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near '('. Incorrect syntax near the keyword 'SET'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Transcript.studentprofileedit.btnUpdate_Click(Object sender, EventArgs e) in C:\Users\Administrator.femzy-PC\Documents\Visual Studio 2010\Projects\Transcript Reloaded\Transcript\studentprofileedit.aspx.cs:line 119 </pre>
 

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