Board index » cppbuilder » ADO with unicode querys...

ADO with unicode querys...


2005-04-28 04:22:23 PM
cppbuilder95
... seems not to be possible.
I'm using Jet engine 4.0 to access a mdb that contains some chinese
unicode characters. With .net and MFC it's working fine, but with
VCL/ADO every "insert into to test values('\x4e01');" results in a "?".
Trying to get data from the mdb with "select * from test where field1
like '%\x4e01'" does not return anything :-(
Are there any changes to get this working or do I need an additional
component like ELPack?
Thanks for tips, Bernd
 
 

Re:ADO with unicode querys...

Which components do you use? Try use TADOCommand and CommandText - it is
WideString. It seems that somewhere there is convertion AnsiString ->
WideString.
//------------------------------------------
Regards,
Vassiliev V. V.
www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Bernd Muent" < XXXX@XXXXX.COM >???????/???????? ? ???????? ?????????:
Quote
... seems not to be possible.
I'm using Jet engine 4.0 to access a mdb that contains some chinese
unicode characters. With .net and MFC it's working fine, but with VCL/ADO
every "insert into to test values('\x4e01');" results in a "?".
Trying to get data from the mdb with "select * from test where field1 like
'%\x4e01'" does not return anything :-(
Are there any changes to get this working or do I need an additional
component like ELPack?

Thanks for tips, Bernd
 

Re:ADO with unicode querys...

Viatcheslav V. Vassiliev schrieb:
Quote
Which components do you use? Try use TADOCommand and CommandText - it is
WideString. It seems that somewhere there is convertion AnsiString ->
WideString.
It tried it this way:
ADOCommand* ac=new TADOCommand(this);
WideString wS="Insert into test (f1,f2) values ('\u4e01 ','AAA')";
ac->CommandText=wS;
ac->Connection=dbConn;
ac->Execute();
delete ac;
And this produces an entry "?"/"AAA" in the mdb-Database (viewing in
Access, not in CBuilder!).
Greetings, Bernd
 

{smallsort}

Re:ADO with unicode querys...

Try this:
wchar_t* w = L"Insert into t (f1,f2) values ('\u4e01 ','AAA')";
WideString wS = WideString(w);
//Set this char again, it seems to be \x01 here.
//Set breakpoint and see actual value. May be it will be correct for you.
//Also \u014e seems to be chinese, instead of \u4e01.
wS[32] = '\u014e';
ADOCommand1->CommandText = wS;
ADOCommand1->Execute();
And set ADOCommand1->ParamCheck = false, when parsing parameters VCL
converts command text to AnsiString.
//------------------------------------------
Regards,
Vassiliev V. V.
www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Bernd Muent" < XXXX@XXXXX.COM >???????/???????? ? ???????? ?????????:
Quote
Viatcheslav V. Vassiliev schrieb:
>Which components do you use? Try use TADOCommand and CommandText - it is
>WideString. It seems that somewhere there is convertion AnsiString ->
>WideString.

It tried it this way:
ADOCommand* ac=new TADOCommand(this);
WideString wS="Insert into test (f1,f2) values ('\u4e01 ','AAA')";
ac->CommandText=wS;
ac->Connection=dbConn;
ac->Execute();
delete ac;

And this produces an entry "?"/"AAA" in the mdb-Database (viewing in
Access, not in CBuilder!).

Greetings, Bernd
 

Re:ADO with unicode querys...

Viatcheslav V. Vassiliev schrieb:
Quote
And set ADOCommand1->ParamCheck = false, when parsing parameters VCL
converts command text to AnsiString.
This was the main problem. Now it works :-)
Thanx, Bernd