Charset problem
Posted: Thu 30 Sep 2010 07:11
Hello,
I am migrating applications from BDE to dbxoda450 with delphi7, the database is Oracle 11g.
Everything works fine apart one problem :
I have a SQLConnection with a AfterConnect event :
procedure TForm1.DB_TESTAfterConnect(Sender: TObject);
const
coCharset = TSQLConnectionOption(204);
begin
// database nls_characterset is set to WE8MSWIN1252
DB_TEST.SQLConnection.SetOption(coCharset, Integer(PChar('WE8MSWIN1252')));
end;
I have a test table :
create table TEST_DBX (TEST_VALUE varchar2(20))
I have two different methods to insert values :
var Q: TSimpleDataSet;
begin
// Insert method 1
Q.DataSet.CommandText:= 'insert into TEST_DBX (TEST_VALUE) values (:TEST_VALUE)';
Q.DataSet.ParamByName('TEST_VALUE').AsString:= 'aâeéeèeêuù'; // <=== Note the âéèêù
Q.DataSet.ExecSQL;
// Insert method 2
Q.DataSet.CommandText:= 'insert into TEST_DBX (TEST_VALUE) values (''aâeéeèeêuù'')'; // <=== Note the âéèêù
Q.DataSet.ExecSQL;
end;
When I read DBX_TEST, here's what I have :
Insert method 1 : aâeéeèeêuù
Insert method 2 : a¿e¿e¿e¿u¿
Is there a method to ensure Insert method 2 works ?
Thanks,
AG
I am migrating applications from BDE to dbxoda450 with delphi7, the database is Oracle 11g.
Everything works fine apart one problem :
I have a SQLConnection with a AfterConnect event :
procedure TForm1.DB_TESTAfterConnect(Sender: TObject);
const
coCharset = TSQLConnectionOption(204);
begin
// database nls_characterset is set to WE8MSWIN1252
DB_TEST.SQLConnection.SetOption(coCharset, Integer(PChar('WE8MSWIN1252')));
end;
I have a test table :
create table TEST_DBX (TEST_VALUE varchar2(20))
I have two different methods to insert values :
var Q: TSimpleDataSet;
begin
// Insert method 1
Q.DataSet.CommandText:= 'insert into TEST_DBX (TEST_VALUE) values (:TEST_VALUE)';
Q.DataSet.ParamByName('TEST_VALUE').AsString:= 'aâeéeèeêuù'; // <=== Note the âéèêù
Q.DataSet.ExecSQL;
// Insert method 2
Q.DataSet.CommandText:= 'insert into TEST_DBX (TEST_VALUE) values (''aâeéeèeêuù'')'; // <=== Note the âéèêù
Q.DataSet.ExecSQL;
end;
When I read DBX_TEST, here's what I have :
Insert method 1 : aâeéeèeêuù
Insert method 2 : a¿e¿e¿e¿u¿
Is there a method to ensure Insert method 2 works ?
Thanks,
AG