读书人

日期 between #039;quot; + DTPicker1.Value +

发布时间: 2012-09-03 09:48:39 作者: rapoo

日期 between '" + DTPicker1.Value + "'and'" + DTPicker2.Value + "'
Private Sub Command1_Click()
Adodc1.RecordSource = "select * from 历史记录 where (日期 between '" + DTPicker1.Value + "'and'" + DTPicker2.Value + "' )and(刀号 like '" & Combo2.Text & "') and(操作者 like '" & Combo1.Text & "')order by 日期 desc"

Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Visible = True
End Sub
为什么总是说类型不匹配呢

[解决办法]
数据库为SQL:
Adodc1.RecordSource = " select * from 历史记录 where (日期 between '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' ) and (刀号 like '" & Combo2.Text & "') and (操作者 like '" & Combo1.Text & "')order by 日期 desc"
数据库为ACCESS:
Adodc1.RecordSource = " select * from 历史记录 where (日期 between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "# ) and (刀号 like '" & Combo2.Text & "') and (操作者 like '" & Combo1.Text & "')order by 日期 desc"

读书人网 >VB

热点推荐