ошибка в этом коде:
try {
string str = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(str);
SqlCommand com = new SqlCommand("UPDATE [Composition] SET [Mark] = @Mark WHERE [Id_composition] = @original_Id_composition AND (([Mark] = @original_Mark) OR ([Mark] IS NULL AND @original_Mark IS NULL))", con);
con.Open();
SqlDataReader reader = com.ExecuteReader();
//reader.Open();
Session.Add("Mark", (int)reader["Mark"]);
Session.Add("Id", (int)reader["Id_composition"]);
com.Parameters.AddWithValue("@original_Id_composition", (Session["Id"]));
com.Parameters.Add("@Mark", SqlDbType.Int).Value =(int)(Session["Mark"])+1;
reader.Close();
con.Close();
LErr.Text = "Спасибо!, нам очень важен ваш голос! ";
}
catch(Exception ex)
{
LErr.Text = "Что то пошло не так--- " + ex.ToString();
}
Здесь в таблице надо в столбец Mark изменить, но вылетает ошибка
System.Data.SqlClient.SqlException (0x80131904): Must declare the scalar variable "@Mark". в System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) в System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) в System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) в System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) в System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() в System.Data.SqlClient.SqlDataReader.get_MetaData() в System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) в System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest) в System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) в System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) в System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) в System.Data.SqlClient.SqlCommand.ExecuteReader() в Diplom.MyKabinet.GV_SelectedIndexChanged(Object sender, EventArgs e) в D:\учеба\4 курс\Диплом\Diplom\Diplom\MyKabinet.aspx.cs:строка 120 ClientConnectionId:b4a9d6da-85b7-4747-bb42-41c9aa705e92 Error Number: 137, State: 2, Class: 15