Getting a strange exception from ExecuteScalar()that I cannot find on the Internet:
Unable to continue execution because the session is in a kill state.
I am using SqlConnection / SqlCommand
The command is a basic INSERT INTO ... with 105 columns (and 105 parameters for setting the column data) followed by SELECT SCOPE_IDENTITY ();
I checked the connection string - this is correct and the connection is open.
I'm not even sure that this error tells me to know where to start looking at it.
So what does this error mean? How does a session in kill state begin?
The code is pretty straight forward:
using (SqlConnection conn = new SqlConnection(connString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(@"INSERT INTO VendorNote (VendorId, AdminComment...) VALUES (@VendorId, @AdminComment, ...); SELECT SCOPE_IDENTITY(); ", conn))
{
cmd.Parameters.AddWithValue("@VendorId", VendorId);
cmd.Parameters.AddWithValue("@AdminComment", AdminComment);
Id = (int) cmd.ExecuteScalar();
}
}