如何写按日期查询这段代码
我要对数据库里的数据按日期查询,主要是按月份查询(1-12),程序是VB.NET 的 WEBFROM,我原来界面已经有了按姓名、区段、机车三个关键字查询,现在想把按日期查询加入,日期查询代码已经写好: 如下
Dim strsql11 As String = "select * from [case] where 添乘时间 > #2006-7-31# and 添乘时间 < #2006-8-31# "
Dim da11 As New OleDbDataAdapter(strsql11, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& Server.MapPath("tianc.asp"))
Dim ds11 As New DataSet
da11.Fill(ds11)
DTATGRID2.DataSource = ds11
DATAGRID2.DataBind()
原来的按姓名等关键字查询的代码如下:
If Txtname.Text <> "" Then
If strSelect <> "" Then
strSelect = strSelect & " And"
End If
strSelect = strSelect & " 姓名 like '%" & Txtname.Text & "%'"
End If
If TextBox1.Text <> "" Then
If strSelect <> "" Then
strSelect = strSelect & " And"
End If
strSelect = strSelect & " 区段 like '%" & TextBox1.Text & "%'"
End If
之后将它们组合成一句 Strselect 语句,执行查询语句,各位,如何把时间这块代码加入,并且是否要一个月写一次,写12 次吗,界面是用下拉选择框进行选择的!在线等!