{
string zhiri = maskedTextBox1.Text
if (radioButton1.Checked == true)
{
sql = "select * from ******* where ******* like '%" + zhiri + "%'"
cmd = new SqlCommand(sql, Class1.me_conn)
sdr = cmd.ExecuteReader()
if (!sdr.Read())
{
MessageBox.Show("********")
maskedTextBox1.Clear()
maskedTextBox1.Focus()
}
//sdr.Close()
else
{
sdr.Close()
dataGridView1.Visible = true
SqlDataAdapter sda = new SqlDataAdapter(sql, Class1.me_conn)
ds = new DataSet()
sda.Fill(ds)
dataGridView1.DataSource = ds.Tables[0]
}
sdr.Close()
}
if (radioButton2.Checked == true)
{
sql = "select * from **** where **** like '%" + zhiri + "%'"
cmd = new SqlCommand(sql, Class1.me_conn)
sdr = cmd.ExecuteReader()
if (!sdr.Read())
{
MessageBox.Show("**********")
maskedTextBox1.Clear()
maskedTextBox1.Focus()
}
//sdr.Close()
else
{
sdr.Close()
dataGridView1.Visible = true
SqlDataAdapter sda = new SqlDataAdapter(sql, Class1.me_conn)
ds = new DataSet()
sda.Fill(ds)
dataGridView1.DataSource = ds.Tables[0]
}
sdr.Close()
}
if (radioButton3.Checked == true)
{
sql = "select * from ******* where ******* like '%" + zhiri + "%'"
cmd = new SqlCommand(sql,Class1.me_conn)
sdr = cmd.ExecuteReader()
if (!sdr.Read())
{
MessageBox.Show("*********")
maskedTextBox1.Clear()
maskedTextBox1.Focus()
}
//sdr.Close()
else
{
sdr.Close()
dataGridView1.Visible = true
SqlDataAdapter sda = new SqlDataAdapter(sql, Class1.me_conn)
ds = new DataSet()
sda.Fill(ds)
dataGridView1.DataSource = ds.Tables[0]
}
sdr.Close()
}
//sdr.Close()
else
{
sdr.Close()
dataGridView1.Visible = true
SqlDataAdapter sda = new SqlDataAdapter(sql, Class1.me_conn)
ds = new DataSet()
sda.Fill(ds)
dataGridView1.DataSource = ds.Tables[0]
}
sdr.Close()
}
这是一个单击事件下的带吗!还有其中****的地方为项目相应的词语!
添加;On Error Resume NextcmdDel.Enabled = Not cmdDel.Enabled
cmdUpDate.Enabled = Not cmdUpDate.Enabled
cmdEsc.Enabled = Not cmdEsc.Enabled
cmdFind.Enabled = Not cmdFind.Enabled
If cmdAdd.Caption = "添加" Then
cmdAdd.Caption = "确定"
Data1.Recordset.AddNew
Data1.Recordset.Update
Text1.SetFocus
Else
cmdAdd.Caption = "添加"
Adodc1.Recordset.MoveLast
End If
删除 On Error Resume Next
Data1.Recordset.Delete
Data1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)