0
我写了下面的查询:从SQL Python的选择得到错误
x1 = 5
y1 = 6
z1 = 0
SQL = ("SELECT Z FROM Points WHERE X =x1 AND Y = y1")
for row in cursor.execute(SQL):
z1 = row.Zcor
我收到以下错误:
Traceback (most recent call last): File "../ppp.py", line 38, in for row in cursor.execute(SQLp1z): pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][\xc4\xf0\xe0\xe9\xe2\xe5\xf0 ODBC Microsoft Access] \xcd\xe5\xee\xef\xf0\xe5\xe4\xe5\xeb\xe5\xed\xed\xe0\xff \xf4\xf3\xed\xea\xf6\xe8\xff 'convert' \xe2 \xe2\xfb\xf0\xe0\xe6\xe5\xed\xe8\xe8. (-3102) (SQLExecDirectW)")
是什么在我的代码错误,什么我需要做的为了防止这种情况发生?
是您的间隔关闭for循环或者是多么你在这里复制呢? –
看看这个,看起来你没有正确地在你的查询字符串中包含变量。 http://stackoverflow.com/questions/902408/how-to-use-variables-in-sql-statement-in-python – Will