c# SQL数据操作问题为什么删除会失败
privatevoidbutton1_Click(objectsender,EventArgse){objCmd=newSqlCommand("deletefromstu...
private void button1_Click(object sender, EventArgs e)
{
objCmd = new SqlCommand("delete from student where student_id = '" + textBox1.Text + "' or Nname = '" + textBox2.Text + "'",objCn);
objCmd.CommandType = CommandType.Text;
try
{
objCmd.ExecuteNonQuery();
MessageBox.Show("删除成功");
}
catch
{
MessageBox.Show("删除失败");
}
} 展开
{
objCmd = new SqlCommand("delete from student where student_id = '" + textBox1.Text + "' or Nname = '" + textBox2.Text + "'",objCn);
objCmd.CommandType = CommandType.Text;
try
{
objCmd.ExecuteNonQuery();
MessageBox.Show("删除成功");
}
catch
{
MessageBox.Show("删除失败");
}
} 展开
1个回答
展开全部
objCmd = new SqlCommand("delete from student where student_id = '" + textBox1.Text + "' or Nname = '" + textBox2.Text + "'",objCn);
objCmd.CommandType = CommandType.Text;
try
{
objCmd.ExecuteNonQuery();
MessageBox.Show("删除成功");
}
catch
{
MessageBox.Show("删除失败");
}
}
sf
sb
sbsb
s
路过
objCmd.CommandType = CommandType.Text;
try
{
objCmd.ExecuteNonQuery();
MessageBox.Show("删除成功");
}
catch
{
MessageBox.Show("删除失败");
}
}
sf
sb
sbsb
s
路过
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询