DAL层的代码:
public int DeleteUserinfo(string name,string pwd)
{
SqlConnection con = new SqlConnection("server=.;database=student;uid=sa;pwd=;");
string sql = "delete from userinfo where name='" + name + "'";
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
int r = cmd.ExecuteNonQuery();
con.Close();
return r;
}
BLL层的代码:
public int DeleteUserinfo(string name)
{
UserInfoDAL dal = new UserInfoDAL();
return dal.DeleteUserinfo(name);
}
click中的代码:
private void btnDelete_Click(object sender, EventArgs e)
{
int id = (int)dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
userInfoBLL bll = new userInfoBLL();
bll.DeleteUserinfo(id);
}
新手,哪有问题的,求解。
鸿蒙传说
扬帆大鱼
FFIVE
相关分类