OleDbDataReader.ExecuteReader exception

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

Guest

Has anyone run across the following exception and have any idea what the
issue is?

System.Data.OleDb.OleDbException: [NCR][Teradata RDBMS] A character string
failed conversion to a numeric value.
at System.Data.OleDb.OleDbCommand.ProcessResults(Int32 hr)
at System.Data.OleDb.OleDbCommand.PrepareCommandText(Int32
expectedExecutionCount)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at TDView_App.Databases.GetSchemaToDD() in C:\Documents and
Settings\...\TDView_App\Databases.vb:line 445


Here is the line of code referenced and the next.

Line 445: Dim TDReader As OleDbDataReader =
TDCmd.ExecuteReader(CommandBehavior.KeyInfo Or CommandBehavior.SchemaOnly)
Line 446: oTable = TDReader.GetSchemaTable()


The reason I'm posting this is that the code runs fine for 463 executions
out of 465, but it consistently thows this exception for 2 views.
As some background, I'm trying to extract table and view schema/metadata
from a Teradata DB. So the
idea behind the code above is to pull just the column metadata (type,
length, etc.) without pulling
any data. And, it works pretty well, except for a small percentage of these
errors. I'm fairly sure the
connection, OleDbDataReader, etc. are correct because of the 463 working
executions.

Is this a Teradata, driver issue, or an ADO.net peculiarity?

Any thoughts would be appreciated.
 
One difference in ADO vs. ADO.NET is when exceptions are fired as you apply
incorrectly scaled or typed data to parameters. In ADO classic it fails on
Value set. In ADO.NET the exception is fired on execution. I suspect you
need to make sure your datatypes are what you say they are (especially for
the problem rows) and the values are in range.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Thank you for your quick response and the information, I was not aware of the
ADO v. .NET differences.

However, in this case, I'm not sure it applies (or at least is the problem).
If I understand what is going on, I am not stateing what the datatypes are,
actually I'm asking what they are. The only types involved in the statement
are the string SQL command in the Command object and the two parameters to
the .ExecuteReader() call. The OleDbDataReader is built by the ADO.NET, or
the provider, so I'm not sure what 'character string' the exection is
refering to. The only 'character string' involved is the SQL and why would it
need to be converted to a numeric value?



William (Bill) Vaughn said:
One difference in ADO vs. ADO.NET is when exceptions are fired as you apply
incorrectly scaled or typed data to parameters. In ADO classic it fails on
Value set. In ADO.NET the exception is fired on execution. I suspect you
need to make sure your datatypes are what you say they are (especially for
the problem rows) and the values are in range.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Keith said:
Has anyone run across the following exception and have any idea what the
issue is?

System.Data.OleDb.OleDbException: [NCR][Teradata RDBMS] A character string
failed conversion to a numeric value.
at System.Data.OleDb.OleDbCommand.ProcessResults(Int32 hr)
at System.Data.OleDb.OleDbCommand.PrepareCommandText(Int32
expectedExecutionCount)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior
behavior)
at TDView_App.Databases.GetSchemaToDD() in C:\Documents and
Settings\...\TDView_App\Databases.vb:line 445


Here is the line of code referenced and the next.

Line 445: Dim TDReader As OleDbDataReader =
TDCmd.ExecuteReader(CommandBehavior.KeyInfo Or CommandBehavior.SchemaOnly)
Line 446: oTable = TDReader.GetSchemaTable()


The reason I'm posting this is that the code runs fine for 463 executions
out of 465, but it consistently thows this exception for 2 views.
As some background, I'm trying to extract table and view schema/metadata
from a Teradata DB. So the
idea behind the code above is to pull just the column metadata (type,
length, etc.) without pulling
any data. And, it works pretty well, except for a small percentage of
these
errors. I'm fairly sure the
connection, OleDbDataReader, etc. are correct because of the 463 working
executions.

Is this a Teradata, driver issue, or an ADO.net peculiarity?

Any thoughts would be appreciated.
 
I'm beginning to think the driver might be an issue (as someone else
suggested).
Try switching from OleDb to ODBC or find a native provider...

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Keith said:
Thank you for your quick response and the information, I was not aware of
the
ADO v. .NET differences.

However, in this case, I'm not sure it applies (or at least is the
problem).
If I understand what is going on, I am not stateing what the datatypes
are,
actually I'm asking what they are. The only types involved in the
statement
are the string SQL command in the Command object and the two parameters to
the .ExecuteReader() call. The OleDbDataReader is built by the ADO.NET, or
the provider, so I'm not sure what 'character string' the exection is
refering to. The only 'character string' involved is the SQL and why would
it
need to be converted to a numeric value?



William (Bill) Vaughn said:
One difference in ADO vs. ADO.NET is when exceptions are fired as you
apply
incorrectly scaled or typed data to parameters. In ADO classic it fails
on
Value set. In ADO.NET the exception is fired on execution. I suspect you
need to make sure your datatypes are what you say they are (especially
for
the problem rows) and the values are in range.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________

Keith said:
Has anyone run across the following exception and have any idea what
the
issue is?

System.Data.OleDb.OleDbException: [NCR][Teradata RDBMS] A character
string
failed conversion to a numeric value.
at System.Data.OleDb.OleDbCommand.ProcessResults(Int32 hr)
at System.Data.OleDb.OleDbCommand.PrepareCommandText(Int32
expectedExecutionCount)
at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior
behavior)
at TDView_App.Databases.GetSchemaToDD() in C:\Documents and
Settings\...\TDView_App\Databases.vb:line 445


Here is the line of code referenced and the next.

Line 445: Dim TDReader As OleDbDataReader =
TDCmd.ExecuteReader(CommandBehavior.KeyInfo Or
CommandBehavior.SchemaOnly)
Line 446: oTable = TDReader.GetSchemaTable()


The reason I'm posting this is that the code runs fine for 463
executions
out of 465, but it consistently thows this exception for 2 views.
As some background, I'm trying to extract table and view
schema/metadata
from a Teradata DB. So the
idea behind the code above is to pull just the column metadata (type,
length, etc.) without pulling
any data. And, it works pretty well, except for a small percentage of
these
errors. I'm fairly sure the
connection, OleDbDataReader, etc. are correct because of the 463
working
executions.

Is this a Teradata, driver issue, or an ADO.net peculiarity?

Any thoughts would be appreciated.
 
Back
Top