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 + "')";
Сообщение об ошибке, которое я получаю после попытки обновить веб-форму:
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