[egenix-users] unicode, sql command, mxODBC
zhihua ouyang
zxo102 at yahoo.com
Wed Nov 10 04:34:53 CET 2004
Hi everyone,
I need your help. I have tried for a while to make
unicoded sql command work with mxODBC in window
xp(Chinese Version) but failed since some unicode
chinese characters are in it.
Here is my case:
1. A Excel file in c:\\test.xls which contains
chinese characters.
2. I got the data from test.xls using the following
code
from win32com.client import DispatchEx
xApp = DispatchEx("Excel.Application")
xBook = xApp.Workbooks.Open('c:\\test.xls')
sheet = xBook.Worksheets('sheet1')
aaa = []
for i in range(10):
aaa.append(sheet.Cell(5,i).Value)
......
and generate sql command dynamically with those
chinese data. The following is an example:
sqlCommandStr = u"INSERT INTO instruments VALUES
('0401', 23800.0,
0.0,'\u4e2d\u56fd','156','2000-1-1','\u5f20\u6167\u82ac');"
But mxODBC gives error info: "sql command must be a
string".
If chinese characters are inserted into the sql
command like
"INSERT INTO instruments VALUES ('0401', 23800.0,
0.0,'²âÊÔ','156','2000-1-1','²âÊÔ');"
everything is fine. But I don't know how to
generate it in above condition.
Does mxODBC accept the unicoded sql command?
Thanks.
Ouyang
__________________________________
Do you Yahoo!?
Check out the new Yahoo! Front Page.
www.yahoo.com
More information about the egenix-users
mailing list