Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: .net OracleClient and character sets
"HaukiDog" <HaukiDog_at_hotmail.com> wrote in message
news:6d3bc6d9.0305021322.488a3c39_at_posting.google.com...
> I have developed some code on an oracle server set to the US7ASCII
> character set. I just found out that my production system is set to
> UTF8. Changing character sets on the production server is not an
> option. There is a string in my member table, which contains some
> wacky characters and is not converting properly.
>
> Is there any way to:
> 1. do a conversion in the select statement, or in an SP?
> 2. is there anyway to chnage the character set in the OracleClient
> code?
>
> I am using an OracleDataReader, the code looks like this:
> ------------------------------------------------------------------
> const string _selectText = "SELECT passwordkey FROM member WHERE
> memberid=:pMemberId";
> OracleCommand myCommand = new OracleCommand();
> myCommand .Connection = _Connection;
> myCommand .CommandType = CommandType.Text;
> myCommand .CommandText = _selectText;
> OracleDataReader myReader =
> myCommand.ExecuteReader(CommandBehavior.SingleRow);
>
> if (!myReader.Read())
> {
> throw new UserUnknownException(UserId);
> }
>
> int passwordkeyOrdinal = myReader.GetOrdinal("passwordkey");
> string PasswordKey = myReader.GetString(passwordkeyOrdinal );
> -----------------------------------------------------------------
>
> Thanks!
I'm not sure why you think you have to post this to all groups you can think
of.
whether or not characters are being converted is determined by the value of
NLS_LANG (registry variable in Windooze, env var in Unix),
and that's all there is to it.
And of course there are conversion functions. Just search on NLS in your
manual.
-- Sybrand Bakker Senior Oracle DBA to reply remove '-verwijderdit' from my e-mail addressReceived on Fri May 02 2003 - 17:58:46 CDT
![]() |
![]() |