Home > database >  Query oracle error
Query oracle error

Time:09-26

Exception information System. InvalidCastException: Specified cast is not valid.
At Oracle. ManagedDataAccess. Client. OracleDataReader. GetDecimal (Int32 I)
At Oracle. ManagedDataAccess. Client. OracleDataReader. GetValue (Int32 I)
At Oracle. ManagedDataAccess. Client. OracleDataReader. GetValues (Object [] values)
At System.Data.ProviderBase.DataReaderContainer.Com monLanguageSubsetDataReader. GetValues (Object [] values)
Ats System. Data. ProviderBase. SchemaMapping. LoadDataRow ()
At System.Data.Com, mon. Dataadapters. FillLoadDataRow (SchemaMapping mapping)
At System.Data.Com, mon. Dataadapters. FillFromReader (DataSet DataSet, DataTable DataTable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
At System.Data.Com, mon. Dataadapters. The Fill (DataSet DataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
At Oracle. ManagedDataAccess. Client. OracleDataAdapter. The Fill (DataSet DataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
At Oracle. ManagedDataAccess. Client. OracleDataAdapter. The Fill (DataSet DataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behaviors)
At System.Data.Com, mon. DbDataAdapter. The Fill (DataSet DataSet, String srcTable)

The code is as follows:
Try
{
SQL=SQL. Replace (" P_start ", (the index * number + 1). The ToString ()). The Replace (" Pend ", ((index + 1) * number). The ToString ());
OpenConn ();
LogHelper. Write (the string. Format (" ExcuteSelectSql=={0} ", SQL));
System. Data. The DataSet ds=new DataSet ();
OracleDataAdapter Ada=new OracleDataAdapter (SQL, conn);
Ada. AcceptChangesDuringFill=true;
Ada. AcceptChangesDuringUpdate=true;
If (tableName=="") tableName=" oracle_data ";
Ada. The Fill (ds, tableName);
LogHelper. Write (the string. Format (" ExcuteSelectSql==table Name: {0}, rows: {1} ", tableName, ds. The Tables [0]. Rows. Count));
CloseConn (conn);
Return the ds. Tables [0];
}
The catch (Exception ex)
{
LogHelper. Write (" ExcuteSelectSql: "+ ex. ToString ());
CloseConn (conn);
return null;
}
Not all SQL error,,, have write SQL execution is normal, but all the SQL executed in PLSQL normal

CodePudding user response:

System. InvalidCastException: Specified cast is not valid.

This is not the ORACLE's fault, should be a Java exception thrown out,

CodePudding user response:

But I just want to return to a table, the query results, did not want to change the data format.. Now is likely an error transformation format

CodePudding user response:

And I just want to let him put the results back to a datatable

CodePudding user response:

System. InvalidCastException: Specified cast is not valid.

This is a question of your c # code, not Oracle,
Check your code carefully, it should be type conversion appear problem,

CodePudding user response:

Available data values, or do not conform to the rules of data, you do check before transformation

CodePudding user response:

You the processing good SQL directly to the output to the log, and then copy out look, c # code has a problem!

CodePudding user response:

[quote=reference 4 floor qq646748739 reply
System. InvalidCastException: Specified cast is not valid.

This is a question of your c # code, not Oracle,
Check your code carefully, it should be type conversion problems,

Cause I have already said,
  • Related