Data Provider Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Hi Paul,

Paul Deibel said:
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.

You are probably formating the value?
Do you get string or number?
 
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
 
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.
 
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==
X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
From: "=?Utf-8?B?UGF1bCBEZWliZWw=?=" <[email protected]>
Subject: Data Provider Problem
Date: Fri, 23 Jan 2004 07:21:06 -0800
Lines: 33
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.adonet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.adonet:72471
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.adonet

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
 
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.
 
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=?=" <[email protected]>
References: <[email protected]>
Subject: RE: Data Provider Problem
Date: Tue, 27 Jan 2004 13:31:07 -0800
Lines: 5
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.adonet
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.adonet:72853
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.adonet

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.
 
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
 
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
 
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
 
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
 
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?= <[email protected]>
References: <[email protected]>
<V#[email protected]>
Subject: RE: Data Provider Problem
Date: Fri, 19 Mar 2004 04:21:09 -0800
Lines: 7
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 8bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.adonet
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:77719
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.adonet

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
 
Back
Top