首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

日期 between '" + DTPicker1.Value + "'and'" + DTPicker2.Value + &qu

2012-09-03 
日期 between + DTPicker1.Value + and + DTPicker2.Value + Private Sub Command1_Click()Adodc

日期 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"

热点排行