日期是以长整型形式表示的select * from wxb where wxry ='维修人员' and (wgrq>20070101 and wgrq<20070131 )
对查询语言不懂的最好安装一个MS SQL SERVER,到帮助里面去看SELECT,尤其是JOIN
selecr*from wxb where wxry='维修人员'and(wgrq>20070101and wgrq<20070131)
If comXM.Text = "" Or txtCZ.Text = "" Then sql = "select * from wxb ORDER BY wgrq" Else Dim xmmc As String '项目名称 If Me.comXM.Text = "维修单号" Then xmmc = "wxid" If Me.comXM.Text = "报修人" Then xmmc = "bxr" If Me.comXM.Text = "完工日期" Then xmmc = "wgrq" If Me.comXM.Text = "服务类型" Then xmmc = "fwlx" If Me.comXM.Text = "服务方式" Then xmmc = "fwfs" If Me.comXM.Text = "维修人员" Then xmmc = "wxry" sql = "select * from wxb where " & xmmc & " like '%" & txtCZ.Text & "%'and (wgrq> '%" & Text1.Text & "%'and wgrq< '%" & Text2.Text & "%' )" End If其中Text1.Text开始日期 Text2.Text 为结束日期
sql = "select * from wxb ORDER BY wgrq"
Else
Dim xmmc As String '项目名称
If Me.comXM.Text = "维修单号" Then xmmc = "wxid"
If Me.comXM.Text = "报修人" Then xmmc = "bxr"
If Me.comXM.Text = "完工日期" Then xmmc = "wgrq"
If Me.comXM.Text = "服务类型" Then xmmc = "fwlx"
If Me.comXM.Text = "服务方式" Then xmmc = "fwfs"
If Me.comXM.Text = "维修人员" Then xmmc = "wxry" sql = "select * from wxb where " & xmmc & " like '%" & txtCZ.Text & "%'and (wgrq> '%" & Text1.Text & "%'and wgrq< '%" & Text2.Text & "%' )"
End If其中Text1.Text开始日期 Text2.Text 为结束日期