小弟比较急啊,问了好多次了可是哪次也不明白,所以今天把图片拿上来了,我想请问,我图片里面的"删除","修改","刷新",怎么做啊!请大家帮帮忙吧!谢谢了啊!!
我还真佩服你这样的精神,一个问题问了好几遍.被你感动了.那就看看下面的吧.(根据我以前做的)
private void button2_Click(object sender, System.EventArgs e)
{
this.sqlInsertCommand2.Parameters["@Id"].Value=textBox1.Text;
this.sqlInsertCommand2.Parameters["@name"].Value=textBox2.Text;
this.sqlInsertCommand2.Parameters["@Sex"].Value=textBox3.Text;
this.sqlInsertCommand2.Parameters["@Age"].Value=textBox4.Text;
this.sqlInsertCommand2.Parameters["@Telephone"].Value=textBox5.Text;
this.sqlInsertCommand2.Parameters["@Code"].Value=textBox6.Text;
this.sqlInsertCommand2.Connection.Open();
this.sqlInsertCommand2.ExecuteNonQuery();
this.sqlInsertCommand2.Connection.Close();
this.sqlConnection1.Open();
this.sqlDataAdapter2.Fill(this.dataSet11);
this.sqlConnection1.Close();
this.dataGrid1.Update();
this.dataGrid1.Refresh();
this.textBox1.Text="";this.textBox2.Text="";
this.textBox3.Text="";this.textBox4.Text="";
this.textBox5.Text="";this.textBox6.Text="";
}
private void button1_Click(object sender, System.EventArgs e)
{
this.sqlDeleteCommand3.CommandText="delete from 表名where Id='"+this.textBox12.Text.Trim()+"'or Name='"+this.textBox11.Text.Trim()+"'or Sex='"+this.textBox10.Text.Trim()+"'or Age='"+this.textBox9.Text.Trim()+"'or Telephone='"+this.textBox8.Text.Trim()+"'or Code='"+this.textBox7.Text.Trim()+"'";
this.sqlDeleteCommand3.Connection.Open();
this.sqlDeleteCommand3.ExecuteNonQuery();
this.dataSet11.Clear();
this.sqlDataAdapter1.Fill(this.dataSet11);
this.sqlDeleteCommand3.Connection.Close();
this.textBox12.Text="";this.textBox11.Text="";
this.textBox10.Text="";this.textBox9.Text="";
this.textBox8.Text="";this.textBox7.Text="";
}
private void button3_Click(object sender, System.EventArgs e)
{
if(radioButton1.Checked==true)
{
this.sqlSelectCommand3.CommandText="select * from 表名where Id='"+this.textBox13.Text.Trim()+"'";
}
else if(radioButton2.Checked==true)
{
this.sqlSelectCommand3.CommandText="select * from 表名 where Name='"+this.textBox13.Text.Trim()+"'";
}
this.sqlConnection1.Open();
this.sqlSelectCommand3.ExecuteNonQuery();
this.dataSet11.Clear();
this.sqlDataAdapter3.Fill(this.dataSet11);
this.dataGrid1.DataSource=this.dataSet11;
this.sqlSelectCommand3.Connection.Close();
if(this.dataSet11.Tables[0].Rows.Count>0)
{
MessageBox.Show("查找成功!","系统提示。",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
MessageBox.Show("查找不成功!","系统提示。",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
this.textBox13.Text="";
}
如果你还没有成功的话,那就请你请教高手了.