[求助]在vb中用SQL如何实现日期的范围查询
For i = 0 To 2If Text2(i).Text = "" Then
s(i) = "0"
Else
s(i) = Text2(i).Text
End If
Next i
ss = Format(CDate(s(0) + "-" + s(1) + "-" + s(2)), "yyyy-mm-dd")
For i = 3 To 5
If Text2(i) = "" Then
s(i) = "0"
Else
s(i) = Text2(i).Text
End If
Next i
ee = Format(CDate(s(3) + "-" + s(4) + "-" + s(5)), "yyyy-mm-dd")
sql = " select * from 设备故障清单 where 设备名称='" & Text1.Text & "' and 故障日期 between #" & ss & "# " & " and " & " # " & ee & " # "
Adodc1.CommandType = adCmdText
从文本框中得到数据变成日期后实现范围查询