本文介绍了删除介于daterange和datewise之间的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表,其中的字段是
idevent snmachine日期时间currencyname模式
我想删除日期从fr0m到日期的选择记录,然后按日期删除记录.
Hi,
I have a table which fields are
Idevent snmachine date time currencyname mode
I want to delete select record between fr0m date and to date and then delete record by datewise.
推荐答案
private void button1_Click(object sender, EventArgs e)
{
search();
}
public void search()
{
con.Open();
OleDbDataAdapter adpt = new OleDbDataAdapter("select * from test where date between '" + dateTimePicker1.Text + "' and '" + dateTimePicker2.Text + "'", con);
ds = new DataSet();
adpt.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
con.Close();
}
private void button2_Click(object sender, EventArgs e)
{
con.Open();
cmd = new OleDbCommand("delete from test where date='"+dateTimePicker3.Text+"'",con);
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Record deleted...");
search();
}
这篇关于删除介于daterange和datewise之间的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!