Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / March 2004

Tip: Looking for answers? Try searching our database.

Data Provider Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Deibel - 23 Jan 2004 15:21 GMT
Hello Everyone:

I am trying to develop a fairly complex application using Visual Studio, (2003)
the .net framework 1.1, and Oracle 9i as the database.  I'm using VB.NET

We found problems with the OLEDB Data Provider that were serious, and
so we took the time to switch our code to the OracleClient Data Provider.

I have written a test program that queries on column from an Oracle table.
The column is defined as number(7,3)

Using OLEDB, the number is returned to a texbox as 6.944

Using OracleClient, the number displays in the textbox as
6.9440

Why is there a trailing 0 using OracleClient?  There is no
trailing zero using OLEDB nor when querying from SQLPLUS.

What is the best way to get rid of this trailing zero?

In the real application that I am developing, there is a regular
expression validator control that checks to make sure that only
three decimals get entered.

^(?:)?\d{0,4}(?:\.\d{0,3})?$

I need to enforce this business rule. The trailing zero is not in
the data, and it is not acceptable.

Please advise.

Paul Deibel
Miha Markic - 23 Jan 2004 17:13 GMT
Hi Paul,

> Hello Everyone:
>
[quoted text clipped - 14 lines]
> Why is there a trailing 0 using OracleClient?  There is no
> trailing zero using OLEDB nor when querying from SQLPLUS.

You are probably formating the value?
Do you get string or number?

Signature

Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Paul Deibel - 23 Jan 2004 17:36 GMT
No formatting.  Here is the code for the test program:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       Dim objreader As OracleClient.OracleDataReader
       Dim objCommand As New OracleClient.OracleCommand
       Dim CopyOfConnection As New OracleClient.OracleConnection
       CopyOfConnection = OracleConnection1
       objCommand.Connection = CopyOfConnection
       CopyOfConnection.Open()
       objCommand.CommandText = "select appvd_pump_rate from ws_source where reg_obj_id = 392905"
       TextBox1.Text = objCommand.ExecuteScalar()
       CopyOfConnection.Close()
   End Sub
"Jeffrey Tan[MSFT]" - 26 Jan 2004 06:44 GMT
Hi Paul,
 
We have reviewed your post. We will do some research on your issue. We will
reply to you ASAP.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security 
This posting is provided "as is" with no warranties and confers no rights.
Felix Wu [MSFT] - 27 Jan 2004 09:18 GMT
Hi Paul,

Oracle engine just returns raw data of 'number' type and you need to format
it as needed in your application or provider. I think this is why the
OLEDB provider and OracleClient behavior differently.

You could try to_char function:

select to_char(numCol, '9.999') from ...

Best regards,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Thread-Topic: Data Provider Problem
>thread-index: AcPhxIVtj/oTFzr3Rnualt/J7jvoTg==
[quoted text clipped - 20 lines]
>
>Hello Everyone:

I am trying to develop a fairly complex application using Visual Studio,
(2003)
the .net framework 1.1, and Oracle 9i as the database.  I'm using VB.NET

We found problems with the OLEDB Data Provider that were serious, and
so we took the time to switch our code to the OracleClient Data Provider.

I have written a test program that queries on column from an Oracle table.
The column is defined as number(7,3)

Using OLEDB, the number is returned to a texbox as 6.944

Using OracleClient, the number displays in the textbox as
6.9440

Why is there a trailing 0 using OracleClient?  There is no
trailing zero using OLEDB nor when querying from SQLPLUS.

What is the best way to get rid of this trailing zero?

In the real application that I am developing, there is a regular
expression validator control that checks to make sure that only
three decimals get entered.

^(?:)?\d{0,4}(?:\.\d{0,3})?$

I need to enforce this business rule. The trailing zero is not in
the data, and it is not acceptable.

Please advise.

Paul Deibel
Paul Deibel - 27 Jan 2004 21:31 GMT
Thanks.  I tried to use to_char, but I also need ltrim and rtrim as well as to_char, as extra spaces showed up with just to_char.

The good news is that I have an approach to use as a workaround. The bad news is how much code I have to change.  Why do the two data providers behave so differently? (OLEDB versus OracleClient)  Are all of the differences documented somewhere?  Is Microsoft planning a patch for OracleClient?  If in the future we need to change the column definitions on the database, we may need to revisit the .net V/B code, and that's not good. I like the way OLEDB handles numbers better.  But did they change things in OracleClient to fix some other problem that I don't know about.  Please advise.

Thanks ... P.D.
Felix Wu [MSFT] - 28 Jan 2004 04:31 GMT
Hi Paul,

It's great to hear that the workaround works.

I am not familiar with OracleClient and not quite sure why it behaves
differently, but I think there may be some reasons. As for the possible
column definitions in the future,  I agree with you that you may need to
revist the code. You can try to format/process the data before binding them
to control directly if necessary. This can make the application more
flexible.

Regards,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Thread-Topic: Data Provider Problem
>thread-index: AcPlHOAXEku67R1nRc6MFzwKQus2vA==
>X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
>From: "=?Utf-8?B?UGF1bCBEZWliZWw=?=" <Paul.Deibel@State.Ma.Us>
>References:  <1B2DB675-893A-48D2-ABF0-F3989C98D3B0@microsoft.com>
<V#KzkaL5DHA.1992@cpmsftngxa07.phx.gbl>
>Subject: RE: Data Provider Problem
>Date: Tue, 27 Jan 2004 13:31:07 -0800
[quoted text clipped - 16 lines]
>
>Thanks.  I tried to use to_char, but I also need ltrim and rtrim as well as to_char, as extra spaces showed up with just to_char.

The good news is that I have an approach to use as a workaround. The bad
news is how much code I have to change.  Why do the two data providers
behave so differently? (OLEDB versus OracleClient)  Are all of the
differences documented somewhere?  Is Microsoft planning a patch for
OracleClient?  If in the future we need to change the column definitions on
the database, we may need to revisit the .net V/B code, and that's not
good. I like the way OLEDB handles numbers better.  But did they change
things in OracleClient to fix some other problem that I don't know about.  
Please advise.

Thanks ... P.D.
Arun R - 19 Mar 2004 13:21 GMT
Dear Felix / Paul

I am facing a problem with oracle client and not getting how to resolve this

I am using System.Data.OracleClient fromframework1.1 in dataset I receive some strange records. It is retrieving the menu records in dataset is not filled correctly. Second record onward in each zero level menu group is corrupted. E.g. in That dataset the table is filled with “AssetShield” in first record and “AssetSh\0\0\0\0\0” value in the next record. If I use the same code with OleDb then it works fine. Also the same program works correctly on another machine. I know there must be some problem with version and oracle driver but not able to figure out

Please help m
Thanks
Arun R
Arun R - 19 Mar 2004 13:21 GMT
Dear Felix / Paul
I am facing a problem with oracle client and not getting how to resolve this
I am using System.Data.OracleClient fromframework1.1 in dataset I receive some strange records. It is retrieving the menu records in dataset is not filled correctly. Second record onward in each zero level menu group is corrupted. E.g. in That dataset the table is filled with “AssetShield” in first record and “AssetSh\0\0\0\0\0” value in the next record. If I use the same code with OleDb then it works fine. Also the same program works correctly on another machine. I know there must be some problem with version and oracle driver but not able to figure out

Please help m
Thanks
Arun R - 19 Mar 2004 13:21 GMT
Dear Felix / Paul

I am facing a problem with oracle client and not getting how to resolve this

I am using System.Data.OracleClient fromframework1.1 in dataset I receive some strange records. It is retrieving the menu records in dataset is not filled correctly. Second record onward in each zero level menu group is corrupted. E.g. in That dataset the table is filled with “AssetShield” in first record and “AssetSh\0\0\0\0\0” value in the next record. If I use the same code with OleDb then it works fine. Also the same program works correctly on another machine. I know there must be some problem with version and oracle driver but not able to figure out

Please help m
Thanks
Arun R
Arun R - 19 Mar 2004 13:21 GMT
Dear Felix / Paul
I am facing a problem with oracle client and not getting how to resolve this
I am using System.Data.OracleClient fromframework1.1 in dataset I receive some strange records. It is retrieving the menu records in dataset is not filled correctly. Second record onward in each zero level menu group is corrupted. E.g. in That dataset the table is filled with “AssetShield” in first record and “AssetSh\0\0\0\0\0” value in the next record. If I use the same code with OleDb then it works fine. Also the same program works correctly on another machine. I know there must be some problem with version and oracle driver but not able to figure out

Please help m
Thanks
Arun R
Felix Wu [MSFT] - 23 Mar 2004 09:13 GMT
Hi Arun,

It seems that your record contains non-english chars, right? For test
purpose, does this occur if you remove these non-english chars from the
record in database?

Also, have you tried to reinstall the Microsoft Managed Provider for
Oracle?

Thanks,

Felix Wu
=============
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Thread-Topic: Data Provider Problem
>thread-index: AcQNrKkVpMOJhKziS8q0jlsWe3XxCw==
>X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
>From: =?Utf-8?B?QXJ1biBS?= <anonymous@discussions.microsoft.com>
>References:  <1B2DB675-893A-48D2-ABF0-F3989C98D3B0@microsoft.com>
<V#KzkaL5DHA.1992@cpmsftngxa07.phx.gbl>
<B7D8B4D2-3ED8-4C2B-A586-A89BF6C9AC08@microsoft.com>
<1GVAqeV5DHA.4028@cpmsftngxa07.phx.gbl>
>Subject: RE: Data Provider Problem
>Date: Fri, 19 Mar 2004 04:21:09 -0800
[quoted text clipped - 16 lines]
>
>Dear Felix / Paul,
I am facing a problem with oracle client and not getting how to resolve
this?
I am using System.Data.OracleClient fromframework1.1 in dataset I receive
some strange records. It is retrieving the menu records in dataset is not
filled correctly. Second record onward in each zero level menu group is
corrupted. E.g. in That dataset the table is filled with
???AssetShield???in first record and ???AssetSh\0\0\0\0\0???value in the
next record. If I use the same code with OleDb then it works fine. Also the
same program works correctly on another machine. I know there must be some
problem with version and oracle driver but not able to figure out.

Please help me
Thanks
Arun R

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.