加急,一个查询的问题。sql语句。50分

jxh_jxh 2000-09-02 11:40:00
我在vb里用一个textbox来实现用户的输入,然后从数据库里查询。比如我的表包括这样一个字段,用户名。我的表是user,str=textbox.text我用“select * from user where 用户名=str",可是总出错,我也用过str=“‘”&textbox.text&"'"可是还不行,众位高手,帮帮我吧
...全文
329 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
bing71 2000-09-07
  • 打赏
  • 举报
回复
错误信息是什么?
ComeFromBeijing 2000-09-06
  • 打赏
  • 举报
回复
'"& text1.text&"'编译就通不过!
czq 2000-09-04
  • 打赏
  • 举报
回复
呵呵 这样的
如果是 数值
查询语句为
"Select * from user where 用户名=" & str
if as string:
"Select * from user where 用户名='" & str &"'"
czq 2000-09-04
  • 打赏
  • 举报
回复
你的用户名是什么样的字段呀
如果是 数值
查询语句为
"Select * into sqlstrcontent from user where 用户名=" & str
if as string:
"Select * into sqlstrcontent from user where 用户名='" & str &"'"
PiterKing 2000-09-04
  • 打赏
  • 举报
回复
Wingsun的回复非常正确,如果还有问题可以试一试
sqlstrcontent=textbox.text
Select * into sqlstrcontent from user where 用户名='sqlstrcontent'
0xFFCD 2000-09-03
  • 打赏
  • 举报
回复
欢迎光临我的VB网站,多多指教。http://lovevb.2699.com
bryan 2000-09-03
  • 打赏
  • 举报
回复
SQL="Select * from user where 用户名='" & TextBox.Text & "'"
应该可以 除非TextBox.text 中包含 " ' "
bokei 2000-09-02
  • 打赏
  • 举报
回复
注意一下单引号是不是用了"‘",通常没关掉输入法就会输错的。应该用"'"才对。
Wingsun 2000-09-02
  • 打赏
  • 举报
回复
你应该这样写
SQL="Select * from user where 用户名='" & TextBox.Text & "'"
bing71 2000-09-02
  • 打赏
  • 举报
回复
str=“‘”& textbox.text & "'"
应该是
str=“'”& textbox.text & "'"

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧