我无法从日期范围内查找出数值,我想根据Combo1的数值、2个DTPicker的日期范围,选出这一时间段的数值。
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\db1.mdb"
'只能显示Combo1.Text的内容,不能把日期的因素也考虑在内
'Adodc1.RecordSource = "select * from gz where gzname='" + Combo1.Text + "'"
Adodc1.RecordSource = "select * from gz where gzname='" + Combo1.Text + "'and (dat between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "# )"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
If Not Adodc1.Recordset.EOF Then
With DataGrid1
.Columns(0).Width = 800
.Columns(1).Width = 2400
End WithEnd If
Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\db1.mdb"
'只能显示Combo1.Text的内容,不能把日期的因素也考虑在内
'Adodc1.RecordSource = "select * from gz where gzname='" + Combo1.Text + "'"
Adodc1.RecordSource = "select * from gz where gzname='" + Combo1.Text + "'and (dat between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "# )"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
If Not Adodc1.Recordset.EOF Then
With DataGrid1
.Columns(0).Width = 800
.Columns(1).Width = 2400
End WithEnd If
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货