不可使用的成员'DetailsForm.cmd'不能像方法一样使用
我试图使命令工作,但它不起作用的帮助。这个错误出现在CMD(“删除不可使用的成员'DetailsForm.cmd'不能像方法一样使用
我必须的SqlCommand CMD;
private void DeleteRecordBtn_Click(object sender, EventArgs e)     { 
     cmd("delete blacklist1 where [email protected]", con); 
     con.Open(); 
     cmd.Parameters.AddWithValue("@idnumber", UID.Text); 
     cmd.ExecuteNonQuery(); 
     con.Close(); 
    } 
回答:
这条线:
cmd("delete blacklist1 where [email protected]", con); 应该是:
cmd = new SqlCommand("delete blacklist1 where [email protected]", con); 但是,你应该把这个在using块内,以便在完成后释放cmd资源。请参阅:SqlCommand with using statement
以上是 不可使用的成员'DetailsForm.cmd'不能像方法一样使用 的全部内容, 来源链接: utcz.com/qa/263870.html
