sql server - Python-Microsoft SQL Insert Variables into Table -


there working request:

msqslquferty1="""insert dbo.users values('namedd188','logindd188','passworddd',0)""" cursor.execute(msqslquferty1) 

but if pass parameters through variables, error occurs.

name1="ur2241" login1="login2241" password1="password2241" voises1="0"  cursor.execute("insert dbo.users(name,login,password,voited) values (%s,%s,%s,%s);"%(name1,login1,password1,voises1)) 

traceback (most recent call last):

file "e:/dropbox/pyton/network/client-server/server/sqlconnect.py", line 33, in cursor.execute("insert dbo.users(name,login,password,voited) values (%s,%s,%s,%s);"%(name1,login1,password1,voises1)) file "e:\pyton\lib\site-packages\pypyodbc-1.3.4-py3.6.egg\pypyodbc.py", line 1626, in execute file "e:\pyton\lib\site-packages\pypyodbc-1.3.4-py3.6.egg\pypyodbc.py", line 1652, in execdirect file "e:\pyton\lib\site-packages\pypyodbc-1.3.4-py3.6.egg\pypyodbc.py", line 1007, in check_success file "e:\pyton\lib\site-packages\pypyodbc-1.3.4-py3.6.egg\pypyodbc.py", line 975, in ctrl_err pypyodbc.programmingerror: ('42s22', '[42s22] [microsoft][odbc sql server driver][sql server]Недопустимое имя столбца "ur2241".')


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -