🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.database.ado
5 messages
5 total messages Started by Bernd Muent Thu, 28 Apr 2005 08:22
ADO with unicode querys...
#796
Author: Bernd Muent
Date: Thu, 28 Apr 2005 08:22
10 lines
1391 bytes
... 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...
#797
Author: Viatcheslav V. Vassiliev
Date: Thu, 28 Apr 2005 19:50
24 lines
2030 bytes
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.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + 
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Bernd Muent" <kontakt@bmservices.de> ???????/???????? ? ???????? ?????????: 
news:42709d41@newsgroups.borland.com...
> ... 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...
#798
Author: Bernd Muent
Date: Fri, 29 Apr 2005 09:51
17 lines
1658 bytes
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...
#799
Author: Viatcheslav V. Vassiliev
Date: Sun, 01 May 2005 20:00
41 lines
2418 bytes
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.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 + 
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)

"Bernd Muent" <kontakt@bmservices.de> ???????/???????? ? ???????? ?????????: 
news:427203b7@newsgroups.borland.com...
> 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...
#801
Author: Bernd Muent
Date: Mon, 02 May 2005 07:19
8 lines
1342 bytes
Viatcheslav V. Vassiliev schrieb:

> And set ADOCommand1->ParamCheck = false, when parsing parameters VCL 
> converts command text to AnsiString.

This was the main problem. Now it works :-)

Thanx, Bernd
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads