西二旗到五棵松地铁:VB高手来帮帮忙

来源:百度文库 编辑:高校问答 时间:2024/05/05 01:01:29
怎么我用这句命令总是显示 “缺少case”
select * from db where name=' & text1.text & "'" 这句
我用VB写的~~~帮帮忙啊~谢谢

格式:
Select Case 表达式
Case 表达式列表1
语句1
Case 表达式列表2
语句2
...
Case 表达式列表n
语句n
[Case Else
语句n+1]
End Select

你没打引号吧,否则设计器才不会把你的这个SQL语句看作标准语句。
建议
MySQL = "select * from db where name='" & text1.text & "'"

sql = "select * from db where name='" & text1.text & "'"

"select * from db where name='" & text1.text & "'"

你是不是把它写在select case中了

select * from db where name=' & text1.text & "'
select case 应在一起
select case * from db where name=' & text1.text & "'
事实看

数据库操作么,也可以是这样
Database.RecordSource = "select * from db where name=' & text1.text & "'""
把操作语句作为字符串传给数据库。