Search code examples
pythonsql-serverencodingpymssql

pymssql insert with CP1250


in last I ask about read, and I solfe problem when I use CP1250 in charset in connection string:

conn_insert = pymssql.connect(host='xxx', user='xxx',
                   password='xxx', database='xxx',charset='CP1250')

And it's ok, i see in console polish chars. But, after insert to database:

query = "Update xxx \
            set xxx='"+variable[x]+"',\
            aaa='"+variable[y]+"'\
            where bbb='"+variable[z]+"'" 

or

 query = "insert into xxx(aaa, bbb, ccc) \
            VALUES ('"+variable[a]+"', '"+variable[b]+"', '"+variable[c]+"')"  

and cursor.execute(above) there are not polish chars in DB.

What I need to do?


Solution

  • Like Panagiotis Kanavos write above, I don't known, why i use hardcoding cadepage XD I see this in some tutorial, and witout mind ;) do in this way ;)

    When I remove this, all it's allright ;) THANKS