"select* from xxx where addDateTime >= #" + dateTimePicker1.Value.ToString("MM/dd/yyyy") + "# and addDateTime <= #" +
dateTimePicker2.Value.AddDays(1).ToString("MM/dd/yyyy") + "# order by addDateTime ";
#12
"select* from xxx where addDateTime >= " + dateTimePicker1.Value.ToString("MM/dd/yyyy") + " and addDateTime <= " +
dateTimePicker2.Value.AddDays(1).ToString("MM/dd/yyyy") + " order by addDateTime ";
上面发的是access查询
#13
给你查询1988-01-01至1995-01-01之间的例子?
int noncePage = Convert.ToInt32(labPage.Text);
PagedDataSource ps = new PagedDataSource();
string sqlSel1 = "select * from tb_huen_lian,tb_HuenLian where ICQ between '1988-01-01' and '1995-01-01' and tb_huen_lian.UserName = tb_HuenLian.UserName and tb_HuenLian.sex like '%" + Session["searchKey2"] + "%' and tb_HuenLian.city like '%" + Session["searchKey1"] + "%'";
ps.DataSource = operateData.getRows(sqlSel1).DefaultView;
ps.AllowPaging = true;
ps.PageSize = 8;//CodeGo.net
ps.CurrentPageIndex = noncePage - 1;
this.lnkbtnFront.Enabled = true;
this.lnkbtnNext.Enabled = true;
this.lnkbtnLast.Enabled = true;
this.lnkbtnFirst.Enabled = true;
#1
select... From ... Where datediff(dd,time字段,@startime)<=0 and datediff(dd,time字段,@endime)>=0
#2
select * from table where data between date1 and date2
date1 和date2 是datatimepicker的值。
#3
string n = dateTimePicker1.Value.ToString();
string l = dateTimePicker2.Value.ToString();
string sql = "select * from Tpay where paydate between "+n+" and "+l+"";
using (SqlDataAdapter da=new SqlDataAdapter (sql,constr))
{
DataSet ds = new DataSet();
da.Fill(ds); //提示这块错误 ( '15' 附近有语法错误。)
this.dataGridView2.DataSource = ds.Tables[0];
}
#4
string sql =string.format( "select * from Tpay where paydate between {0} and {1}",n,l);
#5
select... From ... Where datediff(dd,time字段,@startime)<=0 and datediff(dd,time字段,@endime)>=0
具体帮忙讲下 datediff函数里面的东西代表什么?
#6
select... From ... Where datediff(dd,time字段,@startime)<=0 and datediff(dd,time字段,@endime)>=0
"select* from xxx where addDateTime >= #" + dateTimePicker1.Value.ToString("MM/dd/yyyy") + "# and addDateTime <= #" +
dateTimePicker2.Value.AddDays(1).ToString("MM/dd/yyyy") + "# order by addDateTime ";
#12
"select* from xxx where addDateTime >= " + dateTimePicker1.Value.ToString("MM/dd/yyyy") + " and addDateTime <= " +
dateTimePicker2.Value.AddDays(1).ToString("MM/dd/yyyy") + " order by addDateTime ";
上面发的是access查询
#13
给你查询1988-01-01至1995-01-01之间的例子?
int noncePage = Convert.ToInt32(labPage.Text);
PagedDataSource ps = new PagedDataSource();
string sqlSel1 = "select * from tb_huen_lian,tb_HuenLian where ICQ between '1988-01-01' and '1995-01-01' and tb_huen_lian.UserName = tb_HuenLian.UserName and tb_HuenLian.sex like '%" + Session["searchKey2"] + "%' and tb_HuenLian.city like '%" + Session["searchKey1"] + "%'";
ps.DataSource = operateData.getRows(sqlSel1).DefaultView;
ps.AllowPaging = true;
ps.PageSize = 8;//CodeGo.net
ps.CurrentPageIndex = noncePage - 1;
this.lnkbtnFront.Enabled = true;
this.lnkbtnNext.Enabled = true;
this.lnkbtnLast.Enabled = true;
this.lnkbtnFirst.Enabled = true;