2017-01-28 4 views
0

誰も私のコードがこのエラーを出す理由を教えてもらえますか?Python SqlLite Select文のエラー

sql_statement = '''SELECT name FROM users WHERE username = ? and password =  ?''', (uname, password) 

    #print('About to execute the following SQL statement: \n' + sql_statement) 
    print(type(sql_statement)) 

    cursor.execute(sql_statement) # Execute the SQL statement we created 

エラー出力

cursor.execute(sql_statementは)
とValueError:操作パラメータは

答えて

0

あなたは全体のクエリ文字列の周りに単一引用符を配置する必要はありませんをstrにする必要があります。また、変数の中にバインドして、cursor.execute()を呼び出します。試してみよう:

cursor.execute('SELECT name FROM users WHERE username = ? and password = ?', (uname, password))