from前面多了一个",",另外如果prof字段是字符串型的,则必须加引号
解决方案 »
- 大家别笑啊,偶菜鸟一个,如何录入相关内容到CSDN的Blog中?
- 50分求“文本文件格式ANSI->UNICODE”
- 交叉查询!
- 请问怎样把文本文件转为位图,來者有分
- 说服老板免费送100M邮箱给所有网民,散分
- 有关软件界面设计的问题
- 用VB将数据导出到excel中,怎样使Excel每一打印页都出现相同的表头?
- 请教,中文系统下的程序如何在英文系统下使用?跟字库有关系吗?
- 为何我在程序运行时将MyForm.BorderStyle设为0后,MyForm的标题栏还在?
- 如何在 一个 label 中使用 两种 字体?
- 帮忙!如何将文件读出/写入另一台有口令的机器的共享目录
- 如何生在不带数据的Crystal Reports 报表?
另外,prof字段是文本型的,我加了单引号还是报同样的错误!!!???
select person.name,person.prof,person.seryear," _
& "monthsalary.month,monthsalary.salary,monthsalary.bonus, "_ & "monthsalary.deduct,monthsalary.fact" _
& " from person,monthsalary where person.prof = " & Me.Combo2.Text
& Combo1.Text & "'"
from 后面应该是 "from person inner join monthsalary on person.personid = monthsalary.personid where person.prof = '" & Me.Combo2.Text & "'"
personid是我假定的连接字段
& monthsalary.month,monthsalary.salary,monthsalary.bonus, _
& monthsalary.deduct,monthsalary.fact _
& from person,monthsalary where person.prof = '" & Me.Combo2.Text & "'"
对了!但是person.prof和Combo1.Text都是字符型的,为什么在Combo1.Text上要加一个''?
"select person.name,person.prof,person.seryear," _
& "monthsalary.month,monthsalary.salary,monthsalary.bonus," _
& "monthsalary.deduct,monthsalary.fact" _
& "from person,monthsalary where person.prof = '" & Me.Combo2.Text & "'"
我给你比个例子:
假设你的combo2.text的内容是abcd
那么,如果你写成这样:"select fld1 from table1 where fld2=abcd"
和写成"select fld1 from table1 where fld2=" & combo2.text有什么区别?
但是,"select fld1 from table1 where fld2=abcd"是不正确的。应该是:
"select fld1 from table1 where fld2='abcd'"
明白了?
还是不明白!两边都是字符型呀!按照你的说法,就是要abcd = 'abcd'罗! 等号前面的是字段名,后面是值