以下是我的代码。此代码显示错误"对象引用未设置为对象的实例"。这个错误意味着什么,我该如何解决?
public string ShowRoutineSubjectCode(string class_days)
{
try
{
ConnectionObj.Open();
string query = "SELECT course_code FROM course_table,course_teacher_table WHERE course_table.course_id = course_teacher_table.c_id AND class_days = '"+class_days+"'";
CommandObj.CommandText = query;
return CommandObj.ExecuteScalar().ToString();
}
catch (Exception ex)
{
throw ex;
}
finally
{ //here shows that error
if (ConnectionObj != null && ConnectionObj.State == ConnectionState.Open)
{
ConnectionObj.Close();
}
}
}