VB查询数据只显示第一条 5
PrivateSubCommand1_Click()DimtDate1AsDateDimtDate2AsDatetDate1=Format(Text1.Text,"YYY...
Private Sub Command1_Click()
Dim tDate1 As Date
Dim tDate2 As Date
tDate1 = Format(Text1.Text, "YYYY-MM-DD")
tDate2 = Format(Text2.Text, "YYYY-MM-DD")
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\test.mdb;Persist Security Info=False"
conn.Open
cmd.CommandType = adCmdText
cmd.ActiveConnection = conn
'cmd.CommandText = "select * from test where 日期 >= #" & tDate1 & "# and 日期 <= #" & tDate2 & "#"
cmd.CommandText = "select * from test where ID >= 29 and ID <= 43"
Set rs = cmd.Execute
Set MSHFlexGrid1.DataSource = rs
rs.Close
End Sub
麻烦大家帮我看看 展开
Dim tDate1 As Date
Dim tDate2 As Date
tDate1 = Format(Text1.Text, "YYYY-MM-DD")
tDate2 = Format(Text2.Text, "YYYY-MM-DD")
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Set cmd = New ADODB.Command
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\test.mdb;Persist Security Info=False"
conn.Open
cmd.CommandType = adCmdText
cmd.ActiveConnection = conn
'cmd.CommandText = "select * from test where 日期 >= #" & tDate1 & "# and 日期 <= #" & tDate2 & "#"
cmd.CommandText = "select * from test where ID >= 29 and ID <= 43"
Set rs = cmd.Execute
Set MSHFlexGrid1.DataSource = rs
rs.Close
End Sub
麻烦大家帮我看看 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询