 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Vitali Kalinin Guest
|
Posted: Thu Sep 11, 2003 9:37 am Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
You can try connection string like this:
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user1;Initial
Catalog=test3;Data Source=localhost;Auto Translate=False
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f603e25 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi,
Can any body help me to solve the following problem?
I use TADOConnection and TADOQuery for working with MS SQL Server 2000. My
connection string is:
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user1;Initial
Catalog=test3;Data Source=localhost
When I execute the following sql-statement (I tried to use varchar and
nvarchar for 'name' column):
INSERT INTO Table1 (name) VALUES ('XXXXX')
where XXXXX equals to any Russian word or sentence, I have, for example,
'I?eaao' instead of correct value in the db.
I dig deeper and found that when I change system locale to Russian, all
works fine (correct string is inserted into the database). But I cannot
change system locale because some other application will not work
correctly.
Can anybody advise me any workaround to fix this problem with locale?
Also note, that all works fine from ADO.NET without changing locale. So,
it
seems the database is set up correctly....
--
Nickolai
|
|
|
| Back to top |
|
 |
Nickolai Guest
|
Posted: Thu Sep 11, 2003 9:46 am Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
I tied to use Auto Translate. It also didn't help to solve the problem.
"Vitali Kalinin" <vitkalinin (AT) yahoo (DOT) com> wrote
| Quote: | You can try connection string like this:
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user1;Initial
Catalog=test3;Data Source=localhost;Auto Translate=False
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f603e25 (AT) newsgroups (DOT) borland.com...
Hi,
Can any body help me to solve the following problem?
I use TADOConnection and TADOQuery for working with MS SQL Server 2000.
My
connection string is:
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user1;Initial
Catalog=test3;Data Source=localhost
When I execute the following sql-statement (I tried to use varchar and
nvarchar for 'name' column):
INSERT INTO Table1 (name) VALUES ('XXXXX')
where XXXXX equals to any Russian word or sentence, I have, for example,
'I?eaao' instead of correct value in the db.
I dig deeper and found that when I change system locale to Russian, all
works fine (correct string is inserted into the database). But I cannot
change system locale because some other application will not work
correctly.
Can anybody advise me any workaround to fix this problem with locale?
Also note, that all works fine from ADO.NET without changing locale. So,
it
seems the database is set up correctly....
--
Nickolai
|
|
|
| Back to top |
|
 |
George Christoforakis Guest
|
Posted: Thu Sep 11, 2003 10:44 am Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
The SQL server properties have a locale parameter. Did you change this or
the whole PC's?
George Christoforakis
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> wrote
| Quote: | Hi,
Can any body help me to solve the following problem?
|
|
|
| Back to top |
|
 |
George Christoforakis Guest
|
Posted: Thu Sep 11, 2003 11:09 am Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
open the enterprise manager. Right click on the connection and you will see
a multi-tab setup screen. Click on the server settings and see the default
language for the user. *But* I don't know if this will help you... It's just
a hint ;-)
George Christoforakis
PS: This message is multi-posted... as far as I can see...
..
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> wrote
| Quote: | I don't understand you exactly. What do you mean?
|
|
|
| Back to top |
|
 |
Vitali Kalinin Guest
|
Posted: Thu Sep 11, 2003 12:01 pm Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
How about this: INSERT INTO Table1 (name) VALUES (N'XXXXX'). Sure name
field should be of type nvarchar or nchar.
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f604482 (AT) newsgroups (DOT) borland.com...
| Quote: | I tied to use Auto Translate. It also didn't help to solve the problem.
"Vitali Kalinin" <vitkalinin (AT) yahoo (DOT) com> wrote in message
news:3f60428a$1 (AT) newsgroups (DOT) borland.com...
You can try connection string like this:
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=user1;Initial
Catalog=test3;Data Source=localhost;Auto Translate=False
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f603e25 (AT) newsgroups (DOT) borland.com...
|
|
|
| Back to top |
|
 |
Nickolai Guest
|
Posted: Thu Sep 11, 2003 12:29 pm Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
Checked. I have correct (Russian) language there.
"George Christoforakis" <George.Christoforakis (AT) RatioGroup (DOT) com> wrote in
message news:3f60581f$1 (AT) newsgroups (DOT) borland.com...
| Quote: | open the enterprise manager. Right click on the connection and you will
see
a multi-tab setup screen. Click on the server settings and see the default
language for the user. *But* I don't know if this will help you... It's
just
a hint ;-)
George Christoforakis
PS: This message is multi-posted... as far as I can see...
.
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> wrote in message
news:3f6055e2 (AT) newsgroups (DOT) borland.com...
I don't understand you exactly. What do you mean?
|
|
|
| Back to top |
|
 |
Vitali Kalinin Guest
|
Posted: Thu Sep 11, 2003 5:05 pm Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
I believe that problem is not with ADO but with interaction between MSSQL
server settings and Windows system settings. I think it can be forced to
work properly at least for nvarchar and nchar data types, but it can take
some time to find proper combination of Auto Translate option (IMHO it
should be False) and Windows "Regional settings". You solution doesn't look
like clean one for me, but if it working then it kind of workaround. BTW Can
you insert and select Russian values using QueryAnalyzer or EM? Also can you
give code that gets you problem, may be it will be cleaner if you will
change ThreadLocale temporary and then restore original value back.
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f606a6a (AT) newsgroups (DOT) borland.com...
| Quote: | I tried to use it. It didn't help to solve the problem.
But I found that if I call the following code before starting working with
DB:
SetThreadLocale((SORT_DEFAULT shl 16) or 1049)
or just
SetThreadLocale(1049)
where 1049 is Russian codepage, string is saved correctly. Don't you know
why it happens? Is ADO depends on locale? Note, my system locale (not
default locale) is 1033 (English).
|
|
|
| Back to top |
|
 |
Nickolai Guest
|
Posted: Fri Sep 12, 2003 7:49 am Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
| Quote: | I believe that problem is not with ADO but with interaction between MSSQL
server settings and Windows system settings. I think it can be forced to
work properly at least for nvarchar and nchar data types,
|
I didn't solve the problem...
| Quote: | but it can take
some time to find proper combination of Auto Translate option (IMHO it
should be False)
|
I tried to use Auto Translate=False, but it also didn't help.
| Quote: | and Windows "Regional settings".
|
When I set Regional Setting to Russion, all works fine, but I cannot set it
on the client's computer...
| Quote: | You solution doesn't look
like clean one for me, but if it working then it kind of workaround. BTW
Can
you insert and select Russian values using QueryAnalyzer or EM?
|
Yes, and it allows to insert correct Russian words...
| Quote: | Also can you
give code that gets you problem, may be it will be cleaner if you will
change ThreadLocale temporary and then restore original value back.
|
When I used GetThreadLocale it returns 1033 (English) - it is locale (not
default) of my system. The default locale of my system is set in Regional
Settings and equals to Cyrillic...
I tried to use 'Current Language=1049' in the connection string and it
didn't help. When I used it I
received the following error when connecting:
Language Requested in login '1049' is not an official language name on this
SQL Server. Login fails.
I checked master.dbo.syslanguages table and found there is Russian
language...
But when I used 'Current Language=Russian' I didn't receive any exception,
but it didn't solve the problem (string is saved incorrectly).
| Quote: | "Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f606a6a (AT) newsgroups (DOT) borland.com...
I tried to use it. It didn't help to solve the problem.
But I found that if I call the following code before starting working
with
DB:
SetThreadLocale((SORT_DEFAULT shl 16) or 1049)
or just
SetThreadLocale(1049)
where 1049 is Russian codepage, string is saved correctly. Don't you
know
why it happens? Is ADO depends on locale? Note, my system locale (not
default locale) is 1033 (English).
|
|
|
| Back to top |
|
 |
Vitali Kalinin Guest
|
Posted: Fri Sep 12, 2003 8:37 am Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
As far as I remember Current Language settings control language of SQL
Server messages,so it is not relevant to problem in question. If QA can
insert Russian values then ADO also should be able make same thing.
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f617a98 (AT) newsgroups (DOT) borland.com...
| Quote: | I believe that problem is not with ADO but with interaction between
MSSQL
server settings and Windows system settings. I think it can be forced to
work properly at least for nvarchar and nchar data types,
I didn't solve the problem...
but it can take
some time to find proper combination of Auto Translate option (IMHO it
should be False)
I tried to use Auto Translate=False, but it also didn't help.
and Windows "Regional settings".
When I set Regional Setting to Russion, all works fine, but I cannot set
it
on the client's computer...
You solution doesn't look
like clean one for me, but if it working then it kind of workaround. BTW
Can
you insert and select Russian values using QueryAnalyzer or EM?
Yes, and it allows to insert correct Russian words...
Also can you
give code that gets you problem, may be it will be cleaner if you will
change ThreadLocale temporary and then restore original value back.
When I used GetThreadLocale it returns 1033 (English) - it is locale (not
default) of my system. The default locale of my system is set in Regional
Settings and equals to Cyrillic...
I tried to use 'Current Language=1049' in the connection string and it
didn't help. When I used it I
received the following error when connecting:
Language Requested in login '1049' is not an official language name on
this
SQL Server. Login fails.
I checked master.dbo.syslanguages table and found there is Russian
language...
But when I used 'Current Language=Russian' I didn't receive any exception,
but it didn't solve the problem (string is saved incorrectly).
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f606a6a (AT) newsgroups (DOT) borland.com...
I tried to use it. It didn't help to solve the problem.
But I found that if I call the following code before starting working
with
DB:
SetThreadLocale((SORT_DEFAULT shl 16) or 1049)
or just
SetThreadLocale(1049)
where 1049 is Russian codepage, string is saved correctly. Don't you
know
why it happens? Is ADO depends on locale? Note, my system locale (not
default locale) is 1033 (English).
|
|
|
| Back to top |
|
 |
Viatcheslav V. Vassiliev Guest
|
Posted: Sat Sep 13, 2003 6:10 am Post subject: Re: ADO+MS SQL Server 2000????????? |
|
|
The problem is in converting string to WideString. ADO Express works with
strings but MS ADO - with WideStrings. TADOCommand.CommandText is string and
when it is converted into WideString MultiByteToWideChar function is used
(look WCharFromChar() in System unit). You should use ADO Command object
directly - try set command text with
ADOCommand1.CommandObject.CommandText := '...';
This way you will set command text as WideString and you will not convert it
from string. If you assign string variable to CommandText, be sure that it
is WideString, not AnsiString(string).
//----------------------
Regards,
Viatcheslav V. Vassiliev
http://www.oledbdirect.com
The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f606a6a (AT) newsgroups (DOT) borland.com...
| Quote: | I tried to use it. It didn't help to solve the problem.
But I found that if I call the following code before starting working with
DB:
SetThreadLocale((SORT_DEFAULT shl 16) or 1049)
or just
SetThreadLocale(1049)
where 1049 is Russian codepage, string is saved correctly. Don't you know
why it happens? Is ADO depends on locale? Note, my system locale (not
default locale) is 1033 (English).
"Vitali Kalinin" <vitkalinin (AT) yahoo (DOT) com> wrote in message
news:3f606477 (AT) newsgroups (DOT) borland.com...
How about this: INSERT INTO Table1 (name) VALUES (N'XXXXX'). Sure name
field should be of type nvarchar or nchar.
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f604482 (AT) newsgroups (DOT) borland.com...
I tied to use Auto Translate. It also didn't help to solve the
problem.
"Vitali Kalinin" <vitkalinin (AT) yahoo (DOT) com> wrote in message
news:3f60428a$1 (AT) newsgroups (DOT) borland.com...
You can try connection string like this:
Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=user1;Initial
Catalog=test3;Data Source=localhost;Auto Translate=False
"Nickolai" <NAlexandrov (AT) validio (DOT) com.ua> сообщил/сообщила в новостях
следующее: news:3f603e25 (AT) newsgroups (DOT) borland.com...
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|