SQL的联机查询

来源:百度知道 编辑:UC知道 时间:2024/06/16 09:53:37
select Data from tbRole2Device where RoleID in(select RoleID from where name = " + yonghu + ") and DeviceID in(selsect DeviceID from tbAddress) 。请问一下我的这段SQL语句哪儿出错了呀,谢谢了,很急!

select RoleID from where name = " + yonghu + "

这个地方,你没写表名

from后是表名应该

select Data from tbRole2Device where RoleID in(select RoleID from 表名where name = '" + yonghu.Text + "') and DeviceID in(selsect DeviceID from tbAddress)

select RoleID from 后面表名没有
where name = 后面应该用单引号引起来
yonghu应该是你的控件名吧?那后面应该有Text代表文本内容

初学者的表现

没加表名.