Jacek U
Jacek U

Reputation: 63

How to force Delphi's TADOConnection use ansistring for Command?

I have problem with encoding when I insert into dbf file through ADO.

Connecting string: 'Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties="dBASE IV";Data Source='+extractfilepath(ParamStr(0))+';'+
  'User ID=Admin;Password='

In a insert command i'm converting data to certain codepage but in table are landing different bytes. Probably because of unicode strings.

insert into someDBFFile (f1,f2,f3,f4,f5)
values(
'ATENEUM SPŁśKA Z OGRANICZONŹ ODPOWIEDZIALNOCIŹ S.K.A.  Wpisana w S†dz',
'ie rej.dla Krakowa-r˘dmiežcie Wydzia’ XI Gospodarczy',
'30-741',
'Krak˘w',
'Nad Drwin† 10, '
)

Data after insert into DBF:

ATENEUM SPťKA Z OGRANICZONŤ ODPOWIEDZIALNO?CIŤ S.K.A. Wpisana w SĹdzie rej.dla Krakowa-?rôdmie§cie Wydzia' XI Gospodarczy
30-741Krakôw
Nad DrwinĹ 10,

Should be as in sample code:

'ATENEUM SPŁśKA Z OGRANICZONŹ ODPOWIEDZIALNOCIŹ S.K.A. Wpisana w S†dz', 'ie rej.dla Krakowa-r˘dmiežcie Wydzia’ XI Gospodarczy', '30-741', 'Krak˘w', 'Nad Drwin† 10, '

I tried TADOTable with the same result.

tblZAEX.Insert;
 tblZAEX.FindField('NA1').AsAnsiString:=ToMazovia(Copy(TInvoiceHeaderPartiesSummaryB_Name.asansiString,1,70));
 tblZAEX.FindField('NA2').AsAnsiString:=ToMazovia(Copy(TInvoiceHeaderPartiesSummaryB_Name.asansiString,71,70));
 tblZAEX.Post;

Upvotes: 0

Views: 220

Answers (0)

Related Questions