想在VB中写SQL语句,请问为什么会说关键字select附近有语法错误?
DimsqlAsStringsql="select站号,时间,"&Combo2.Text&"fromtestwhere站号='"&Combo1.Text&"'And时间>...
Dim sql As String
sql = "select 站号,时间," & Combo2.Text & " from test where 站号='" & Combo1.Text & "'And 时间>='" & DTPicker1.Value & "'And 时间<='" & DTPicker2.Value & "'"
Adodc1.RecordSource = sql
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
Adodc1.Refresh
想实现查询功能在DataGrid控件中显示查询结果,怎么做? 展开
sql = "select 站号,时间," & Combo2.Text & " from test where 站号='" & Combo1.Text & "'And 时间>='" & DTPicker1.Value & "'And 时间<='" & DTPicker2.Value & "'"
Adodc1.RecordSource = sql
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
Adodc1.Refresh
想实现查询功能在DataGrid控件中显示查询结果,怎么做? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询