我得到一个SQL语句,我从哪里选择访问数据库在VB中,但我得到这个错误; “查询表达式中的语法错误select sum(bring_qtty)”当我运行我的程序时。我想像是做正确的事情,但似乎没有。我怎样才能调整这个选择?代码如下:语法错误与选择在VB中选择访问SQL
"select distinct(brought_price) as [Price], select sum(brought_qtty) as [Ordinary] from brought_coffee where " & _
"coffee_grade=O, select sum(brought_qtty) as [Premium] from brought_coffee where" & _
"coffee_grade=P, sum(brought_qtty) as [Total Qtty]" & _
", sum(brought_paid) as [paid], " & _
"sum(brought_bal) as [Balance]" & _
"from brought_coffee, farmer where brought_date=#" & dtc.Text.Trim & "# and farmer_centre='" & cc.Text.Trim & _
"' and farmer.farmer_num=brought_coffee.farmer_num"
使用查询设计窗口创建一个可以工作的查询,或者至少为您提供一些您想要的内容并在此处发布。 – Fionnuala 2012-04-14 19:56:28
谢谢@Remou。让我试试 – ken 2012-04-14 20:05:43
**绝不**使用字符串连接来代替来自用户控件的数据!你正在设置自己被黑客攻击。 – 2012-04-14 20:23:06