对象引用未设置为对象的实例。遇到此异常,我该如何解决此问题。
public bool Remove(/*int id*/UserMaster item)
{
con = null;
using (SqlConnection sqlCon = new SqlConnection(connectionstring))
{
SqlCommand cmd = new SqlCommand("spDeleteEmployee", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter paramID = new SqlParameter();
paramID.ParameterName = "@ID";
paramID.Value =item.ID;
cmd.Parameters.Add(paramID);
ERROR LINE: con.Open();
cmd.ExecuteNonQuery();
}