PC Review


Reply
Thread Tools Rate Thread

Big microsoft bug...

 
 
Arjan
Guest
Posts: n/a
 
      26th Aug 2003
Hi!,

Microsoft tried to create a Oracle provider on their own.
Pretty cool and with our trust in Microsoft we immediatly
started using it.

The problem is you can only update / insert standard ASCII
values using parameters. Whenever you try this with
characters like ė, č, Ē, etc the provider updates /
insertes crap.

Unless i am doing something completely stupid, this is a
big bug in the System.Data.OracleClient making it useless
for us to use ( with parameter OracleCommand ). Back to
the ODBC drivers...

I hope somebody can explain to me what i am doing wrong,
or comfirm that this is a big bug indead.
 
Reply With Quote
 
 
 
 
Uwe Hafner
Guest
Posts: n/a
 
      26th Aug 2003
Hi,

Actually I used your code from the previous thread.

I created a table with the following statement:

create table mytable
(
idnr integer,
test varchar(10)
);

and inserted a row for the update.

My code was:

System.Data.OracleClient.OracleConnection myConnection =
new System.Data.OracleClient.OracleConnection
("Password=***;User ID=system;Data Source=myTNS;Persist Security
Info=True");

myConnection.Open();
System.Data.OracleClient.OracleCommand myCommand =
myConnection.CreateCommand();

myCommand.CommandText =
"Update mytable set test = " +
":myValue where idnr = :myID";

myCommand.Parameters.Add(":myValue",
System.Data.OracleClient.OracleType.VarChar,10);

myCommand.Parameters.Add(":myID",
System.Data.OracleClient.OracleType.Int32);

myCommand.Parameters[":myValue"].Value = "My problėm.";
myCommand.Parameters[":myID"].Value = 1;
myCommand.ExecuteNonQuery();

myConnection.Close();


I was not able to reproduce your behaviour so the codepage is still just a
guess.

But if you want to keep looking into it:
My server uses the same codepage as my windows (1252. i.e. on Oracle
WE8MSWIN1252). You can check the codepage on oracle with:
select * from nls_database_parameters where parameter = 'NLS_CHARACTERSET'

On the client you can use the c# code:
MessageBox.Show(System.Text.Encoding.Default.CodePage.ToString());

I used:
..NET Framework 1.1
MS Managed provider for Oracle Version 1.0.5000.0
Oracle 9 as Client and DB Server

hth
Uwe

"Arjan" <(E-Mail Removed)> schrieb im Newsbeitrag
news:0dbd01c36bc4$21e3b8c0$(E-Mail Removed)...
Hi Uwe,

Thank you for your reply. Here is a code example of what i
did:

<snip>

The value "My problėm." will not be updated / inserted
correctly because of the ė character. Instead My
problƫƫm. will be posted to the database.

I am not allowed to change the Oracle database
characterset. Changing Varchar to NVarchar makes no
difference. By using no parameters i am capable of making
the correct insertion:

myCommand.CommandText = "Update tablename set fieldname
= 'My problėm' where id= 10";

myCommand.ExecuteNonQuery();

That is why i thought the Oracleprovider made the mistake.
After assigning the value to the parameter the watch
expression displays the correct value. Only after
ExecuteNonQuery the value gets messed up.

I would really like to know if you used equal code
statements to perform the update. I will do some more
research to find out more about the charactersets.

Thanks.


 
Reply With Quote
 
Arjan
Guest
Posts: n/a
 
      26th Aug 2003
Thank you very much for going trough all that work for us
Uwe. We found out that the OLEDB provider works without
this "bug" and would probalbly switch over because we
cannot ( are not allowed to ) alter the session
characterset. You have been a great help though!

>-----Original Message-----
>Hi,
>
>Actually I used your code from the previous thread.
>
>I created a table with the following statement:
>
>create table mytable
>(
>idnr integer,
>test varchar(10)
>);
>
>and inserted a row for the update.
>
>My code was:
>
>System.Data.OracleClient.OracleConnection myConnection =
> new System.Data.OracleClient.OracleConnection
> ("Password=***;User ID=system;Data Source=myTNS;Persist

Security
>Info=True");
>
>myConnection.Open();
>System.Data.OracleClient.OracleCommand myCommand =
> myConnection.CreateCommand();
>
>myCommand.CommandText =
> "Update mytable set test = " +
> ":myValue where idnr = :myID";
>
>myCommand.Parameters.Add(":myValue",
>System.Data.OracleClient.OracleType.VarChar,10);
>
>myCommand.Parameters.Add(":myID",
>System.Data.OracleClient.OracleType.Int32);
>
>myCommand.Parameters[":myValue"].Value = "My problėm.";
>myCommand.Parameters[":myID"].Value = 1;
>myCommand.ExecuteNonQuery();
>
>myConnection.Close();
>
>
>I was not able to reproduce your behaviour so the

codepage is still just a
>guess.
>
>But if you want to keep looking into it:
>My server uses the same codepage as my windows (1252.

i.e. on Oracle
>WE8MSWIN1252). You can check the codepage on oracle with:
>select * from nls_database_parameters where parameter

= 'NLS_CHARACTERSET'
>
>On the client you can use the c# code:
>MessageBox.Show

(System.Text.Encoding.Default.CodePage.ToString());
>
>I used:
>..NET Framework 1.1
>MS Managed provider for Oracle Version 1.0.5000.0
>Oracle 9 as Client and DB Server
>
>hth
>Uwe
>
>"Arjan" <(E-Mail Removed)> schrieb im Newsbeitrag
>news:0dbd01c36bc4$21e3b8c0$(E-Mail Removed)...
>Hi Uwe,
>
>Thank you for your reply. Here is a code example of what i
>did:
>
><snip>
>
>The value "My problėm." will not be updated / inserted
>correctly because of the ė character. Instead My
>problƫƫm. will be posted to the database.
>
>I am not allowed to change the Oracle database
>characterset. Changing Varchar to NVarchar makes no
>difference. By using no parameters i am capable of making
>the correct insertion:
>
>myCommand.CommandText = "Update tablename set fieldname
>= 'My problėm' where id= 10";
>
>myCommand.ExecuteNonQuery();
>
>That is why i thought the Oracleprovider made the mistake.
>After assigning the value to the parameter the watch
>expression displays the correct value. Only after
>ExecuteNonQuery the value gets messed up.
>
>I would really like to know if you used equal code
>statements to perform the update. I will do some more
>research to find out more about the charactersets.
>
>Thanks.
>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft offers a wide range of software, services, and Internettechnologies for personal and business computing. Featuring Microsoft Office,Microsoft Word, ... reddy Microsoft Word Document Management 0 7th Sep 2008 06:40 AM
,microsoft.public.vsnet.ide,microsoft.public.dotnet.framework.windowsforms.controls,microsoft.public.dotnet.languages.csharp Frnak McKenney Microsoft C# .NET 0 21st Jul 2005 02:48 AM
microsoft.public.developer.outlook.addins, microsoft.public.outlook.program_addins,microsoft.public.dotnet.languages.csharp,microsoft.public.outlook.general Anushya Microsoft C# .NET 0 15th Jan 2004 07:18 AM
microsoft.public.developer.outlook.addins,microsoft.public.dotnet.languages.csharp,microsoft.public.outlook.program_addins,microsoft.public.outlook.general Anushya Microsoft Dot NET Framework Forms 0 9th Jan 2004 08:21 AM
microsoft.public.windowsxp.general, microsoft.public.windowsxp.configuration_manage, microsoft.public.windowsxp.basics,microsoft.public.windowsxp.customize, microsoft.public.windowsxp.network_web, microsoft.public.windowsxp.perform_maintain, microso Dan Irwin Windows XP General 2 12th Nov 2003 08:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:24 PM.