SQL查询选择放入变量

时间:2018-01-03 21:14:43

标签: sql vb.net variables ms-access

Dim dt As New DataTable
dt = runsql("select Question_Topic, Question_Difficuilty from QuestionMutli) where Question_Topic = '" & quiztopic & "' and Question_Difficuilty = " & DifficultyLevel & "")

我写了这段代码,如果它们与测验主题变量和难度级别变量匹配,则将记录放在dt变量中,但是当程序运行dt = ...行时,它会出现:

 System.Data.OleDb.OleDbException: 'Syntax error (missing operator)
 in query expression 'Question_Difficuilty QuestionMutli Topic where 
Question_Topic = 'Algebra And Functions' and Question_Difficuilty = 1'.'

测验主题变量是字符串,难度级别是整数。这是MS Access。

有谁知道导致语法错误的原因是什么?

1 个答案:

答案 0 :(得分:0)

你的表格名称为QuestionMutli后,你还有一个额外的关闭。