0 Replies Latest reply: May 17, 2011 2:02 PM by 779391 RSS

    Error filling dataset with OracleDataAdapter in VB.NET

    779391
      Hi...

      This solution executes a procedure inside a package in an Oracle database and returns a data set with 2 fields: one numeric and one a description varchar.

      I have a solution with VS2008 (actually i have the same issue with vs2010) with two proyects:

      (A) A Dll project type that allows me to access a database via System.Data.OracleClient
      (B) A WinForms Project that allows me to use the first (A) making the call to storeprocedures in the database.



      Sample code of (A):

      Imports System.Data.OracleClient
      ....
      ...Declarations and more....
      ...

      If Not myDataset Is Nothing Then

      'Configura el objeto adapter con el objeto Command para recuperar la información
      'y dejarla sobre el dataset
      Dim adpAdapter As New OracleDataAdapter(_oracleCommand)


      * adpAdapter.Fill(myDataset)*


      adpAdapter = Nothing

      DatasetStatus = Nothing
      DatasetStatus = New DatasetClass(myDataset)

      Return True

      Else

      _oracleCommand.ExecuteNonQuery()

      Return True

      End If


      (B) The code sample is this:

      Dim db As New xxxDll.OracleClass()
      Dim mytable As New DataSet

      db.AddParameter("T_PRUEBA_CURSOR", OracleType.Cursor, mytable, ParameterDirection.Output)
      If db.ExecuteStoredProcedure("Pck_Prueba.Sp_Prueba", mytable) Then

      End If


      When the errors occurs?

      Here: adpAdapter.Fill(myDataset)

      What is the error?

      Error converting the DataSet param to DateTime.
      InnerException: The object must implements IConvertible

      The funny thing is that when placed around the code in the same "layer" and not in 2 layers works perfectly ...

      Something happens when the connection object is encapsulated database and its value is returned to its level or upper layer


      This error does not allow me to implement the philosophy of 3 layers, does anyone have any idea?

      Thanks in advance ....