using python "pyodbc" module for extarcting data from excel sheet. When I use numeric instead of win_b64, This program works, for string i.e. win_b64 It is showing below error. I want to retrive data like in below condition "where platform = win_b64 and context_id = 806"
import pyodbc
exFile = r'C:\Python34\abc.xls'conn1 = pyodbc.connect('DRIVER={MicrosoftExcel Driver (*.xls)};DBQ='+exFile,autocommit=True)
curs1 = conn1.cursor()
excel = curs1.execute('select [problem_name] from [Sheet1$] where platform_name = win_b64 ;').fetchall()
p = (excel)
for x in p:
print(x[0])
Error:
pyodbc.Error: ('07002', '[07002] [Microsoft][ODBC Excel Driver] Too few parameters. Expected 1. (-3010) (SQLExecDirectW)')
Solution:
-> query syntax should be start in triple quot...and end too.