我将变量传递给 SQL 查询。
Dim accept As String
accept = Cursor1.GetString("accepted_id")
Msgbox(accept, "")
Cursor1 = SQL1.ExecQuery("SELECT answer FROM answers WHERE accepted_id =" & " 'accept' " )
还有更多代码,但这应该足够了。没有错误,并且 msgbox 显示正确答案。一切看起来都不错,但它没有检索到任何结果。
如果我硬编码答案而不是它的变量,例如,
Dim accept As String
accept = Cursor1.GetString("accepted_id")
Msgbox(accept, "")
Cursor1 = SQL1.ExecQuery("SELECT answer FROM answers WHERE accepted_id =" & " 'CD6028' " )
msgbox 显示 CD6028。
结果显示在列表视图中,但什么也没有。