The below piece of code that throws the following exception..
Error Message:
Object reference not set to an instance of an object. Stack Trace:
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
I am lost as to the reason why..
sqlcon = new SqlConnection(strSqlconnection);
SqlCommand sqlcomSMCheckin = new SqlCommand("prc_CheckIn", sqlcon);
sqlcomSMCheckin.CommandType = CommandType.StoredProcedure;
sqlcomSMCheckin.Parameters.Add("@Description", SqlDbType.VarChar).Value = "My App";
sqlcomSMCheckin.CommandTimeout = this.iCommandTimeOut;
if (sqlcon.State == ConnectionState.Closed)
{
sqlcon.Open();
}
if (sqlcomSMCheckin != null)
{
sqlcomSMCheckin.ExecuteNonQuery(); // error here
sqlcomSMCheckin.Dispose();
}