111,125
社区成员
发帖
与我相关
我的任务
分享
if(result>0)
{
MessageBox.Show("删除成功");
This.TextBox1.Clear();
}
public void button2_Click(object sender, EventArgs e)
{
DialogResult dr=MessageBox.Show("确实要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr==DialogResult.OK)
{
string connStr = "连接字符串";
int result = 0;
string sql = "delete from 投资方信息表 where 投资方名称 = @Name"
string Name = this.TextBox1.Text.Trim();
sqlparameter parm = new sqlparameter("Name",Name);
using(OleDbConnection conn = new OleDbConnection(connStr);)
{
SqlCommand cmd = new SqlCommand();
SqlCommand.Text = sql;
SqlCommand.Parameters.Add(parm);
SqlCommand.Connection = conn;
SqlCommand.CommandType = CommandType.Text;
result = Convert.ToInt32(cmd.ExecuteNonQuery());
}
if(result>1)
{
MessageBox.Show("删除成功");
This.TextBox1.Clear();
}
else
{
MessageBox.Show("删除失败");
This.TextBox1.Focus();
}
}
}
DialogResult dr=MessageBox.Show("确实要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr==DialogResult.OK)
{
int i = cmd.ExecuteNonQuery();
if(i>0)
{
MessageBox.Show("删除成功");
textBox11.Text="";
}
}
DialogResult dr = MessageBox.Show("确实要删除吗","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = "";
}