Sabecki Guest
|
Posted: Wed Nov 23, 2005 4:19 pm Post subject: Inserting unicode string into database using ADO(dbGo) |
|
|
Hello
I have a problem which I have been fighting with for a couple of days,
but I haven't solve it yet. I was looking on Google, but didn't find
solution. Everything seems to be OK, but it's not working.
I use Delphi2005, Oracle 9i database, dbGo(ADO) components and Oracle
Provider for OLE DB. My project is Delphi for .NET. In database I have
a table with column of type NVARCHAR2, where I store Unicode chars.
Records are shown in TDBGrid and everything is correct, there is
unicode.
The problem begins with insert operation. I use TADOQuery linked with
TADOConnection. SQL command is 'insert into uni_test(ntext)
values(:ntext)'. Parameter 'ntext' is created. I assign it with unicode
string from TEdit:
var ws : WideString;
v : Variant;
ws := Edit3.Text;
v := ws;
ADOQuery1.Parameters.ParamByName('ntext').Value := v;
ADOQuery1.Parameters.ParamByName('ntext').DataType := ftWideString;
It is all correct now, even if I try:
ws := ADOQuery1.Parameters.ParamByName('ntext').Value;
ShowMessage(ws);
there is unicode string shown, if I try:
ADOQuery1.ExecSQL();
only question marks(?????) are written to database.
What's the problem?
I have to mention, that:
- Delphi2005 controls show unicode strings
- in database there are unicode strings for sure, cuz I can show them
- ADOQuery parameter(Variant) before execution is also unicode
- to show and insert operations I use the same TADOConnection component
For me it looks like there is a switch like "useUnicode = true" or sth
which should be on, but I can't find nothing appropriate.
Help me, please!!! |
|