如何写按日期查询这段代码

FUKAILIANG 2006-10-16 02:59:06
我要对数据库里的数据按日期查询,主要是按月份查询(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 次吗,界面是用下拉选择框进行选择的!在线等!
...全文
120 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
xingyaohua 2006-10-16
  • 打赏
  • 举报
回复
up

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧