回 帖 发 新 帖 刷新版面

主题:请教!

Adodc1.RecordSource = "select * from publishers 
   where company name='" & Text2.Text  & "'and pubid='" & Text1.Text & "'"

运行时,出现语法错误(操作符丢失),这是怎么回事?

回复列表 (共1个回复)

沙发

Adodc1.RecordSource = "select * from publishers 
   where [company name]='" & Text2.Text  & "' and pubid='" & Text1.Text & "'"
1.字段命名中间最好不要有空格,如果有用[]括起来
2.& "'and pubid='" & Text1.Text & "'" --你的这句中'和and中间无空格,连在一起了成了'and在数据库中'and以及and之后的都成为了字符串,不能被编译

我来回复

您尚未登录,请登录后再回复。点此登录或注册