1,216
社区成员
发帖
与我相关
我的任务
分享
Private Sub Command3_Click()
Dim cnn As Object, Rs as object, CnnStr as string,SqlStr as string
Set cnn = New ADODB.Connection
set Rs= New ADODB.Recordset
CnnStr ="PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Data.mdb" '////注意要把Data.mdb的路径写全,C:\Data.mdb只是我随便写的
cnn.Open CnnStr
if cnn.state=1 then
sqlstr="Select Max(Val) As MaxVal From FloatTable where DateAndTime between #" & DTPicker1.Value & "# and #" & DTPicker2.Value & "#"
set rs=cnn.execute(sqlstr)
if not rs.eof then
Text1.Text = rs(0)
end if
end if
End Sub