各位大牛前辈,我做的多条件查询有个问题,求各位大神指点!
我做的多条件查询见面上用了两个DTpicker,一个选择日期,一个选择时间,但是数据库里是把日期和时间放在一个字段里用的是timer记录的,这个查询该怎么实现啊?本人菜鸟,在线坐等大牛指点! --------------------编程问答-------------------- 两者相加再查询呗。 --------------------编程问答--------------------
那麻烦你再帮我看一下,我现在写成这样行不行。
Private Sub Command1_Click()
Dim str As String
str = "select * from shoufeibiao where sftime between '" & DTPicker1.Value + DTPicker3.Value & "' and '" & DTPicker2.Value + DTPicker4.Value & "' and chedao ='" & Combo1.Text & "'ruzhan = '" & Combo2.Text & "' and userid ='" & Text1.Text & "' and chexing='" & Combo3.Text & "'and cheqing='" & Combo4.Text & "'and banci='" & Combo5.Text & "'"
Adodc1.RecordSource = "select * from shoufeibiao where sftime between '" & DTPicker1.Value + DTPicker3.Value & "' and '" & DTPicker2.Value + DTPicker4.Value & "' and chedao ='" & Combo1.Text & "'ruzhan = '" & Combo2.Text & "' and userid ='" & Text1.Text & "' and chexing='" & Combo3.Text & "'and cheqing='" & Combo4.Text & "'and banci='" & Combo5.Text & "'"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
这样执行总是报错啊,不知道为什么。 --------------------编程问答-------------------- 这样试试:
sftime between '" & DTPicker1.Value & " " & DTPicker3.Value & "' and '" & DTPicker2.Value & " " & DTPicker4.Value & "' --------------------编程问答--------------------
这样试了,还是报错。
对象“refresh”的方法IADodc失败
不知道为什么? --------------------编程问答-------------------- 加我QQ8152456,我可以帮你解决
补充:VB , 基础类