[Mono-dev] System.Data.OracleClient.OracleParameter.SetOracleType() bug?

iamwind iamwind76 at hotmail.com
Thu Sep 29 09:53:28 EDT 2011


the source code:
                private void SetOracleType (OracleType type, bool inferring)
		{                        
			FreeHandle ();			
			Type valType = value.GetType ();
			string exception = String.Format ("No mapping exists from OracleType {0}
to a known DbType.", type);
                        ..............
                }


if we use VS.Net generate DataSet, following error will be reported:

Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object
  at System.Data.OracleClient.OracleParameter.SetOracleType (OracleType
type, Boolean inferring) [0x00000] in <filename unknown>:0 
  at System.Data.OracleClient.OracleParameter.set_OracleType (OracleType
value) [0x00000] in <filename unknown>:0 
  at System.Data.OracleClient.OracleParameter..ctor (System.String name,
OracleType oracleType, Int32 size, ParameterDirection direction,
System.String sourceColumn, DataRowVersion sourceVersion, Boolean
sourceColumnNullMapping, System.Object value) [0x00000] in <filename
unknown>:0 
  at (wrapper remoting-invoke-with-check)
System.Data.OracleClient.OracleParameter:.ctor
(string,System.Data.OracleClient.OracleType,int,System.Data.ParameterDirection,string,System.Data.DataRowVersion,bool,object)
  at ETL.QCSXTableAdapters.T_BIAOZHUN_JIGOUTableAdapter.InitAdapter ()
[0x00000] in <filename unknown>:0 
  at ETL.QCSXTableAdapters.T_BIAOZHUN_JIGOUTableAdapter.get_Adapter ()
[0x00000] in <filename unknown>:0 
  at ETL.QCSXTableAdapters.T_BIAOZHUN_JIGOUTableAdapter.Fill
(ETL.T_BIAOZHUN_JIGOUDataTable dataTable) [0x00000] in <filename unknown>:0 


Would you modify the code like following?

Type valType = typeof(System.String);
			if(value != null)
			{
				valType = value.GetType ();
		  }

thanks!


--
View this message in context: http://mono.1490590.n4.nabble.com/System-Data-OracleClient-OracleParameter-SetOracleType-bug-tp3855825p3855825.html
Sent from the Mono - Dev mailing list archive at Nabble.com.


More information about the Mono-devel-list mailing list