Click here to Skip to main content
15,885,021 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got an error when i used the OracleDataAdapter.Fill(Dataset) function, here is my code so you can see that there is no Syntax error

VB
Public Function getList(ByVal pVar As String) As DataSet
        Dim ds As New DataSet()
        Dim oraData As OracleDataAdapter = Nothing
        Try
            Using command As New OracleCommand(q_get_menu, AccesoDatosOracle.Instance)
                AccesoDatosOracle.Instance.Open()
                command.CommandType = CommandType.StoredProcedure

                Dim parm1 As OracleParameter = New OracleParameter("pVAR", OracleDbType.Varchar2)
                parm1.Direction = ParameterDirection.Input
                parm1.Value = pVar
                command.Parameters.Add(parm1)

                Dim parm2 As OracleParameter = New OracleParameter("pcur_tablapadre", OracleDbType.RefCursor)
                parm2.Direction = ParameterDirection.Input
                parm2.Value = DBNull.Value
                command.Parameters.Add(parm2)

                Dim parm3 As OracleParameter = New OracleParameter("pcur_tablahijo", OracleDbType.RefCursor)
                parm3.Direction = ParameterDirection.Input
                parm3.Value = DBNull.Value
                command.Parameters.Add(parm3)

                command.BindByName = True
                oraData = New OracleDataAdapter(command)
                oraData.Fill(ds)

            End Using
        Catch ex As Exception
            Console.WriteLine("EL error es:  " + ex.Message)
            Throw ex
        Finally
            AccesoDatosOracle.Instance.Close()
        End Try

        Return ds
    End Function


When the debug line gets into the fill(ds) gives an error, it says that the space in the memory was already been occupied. When I declare Dim ds As DataSet = Nothing is says that it cannot take null value.

I don't know what is wrong with this code.

thanks in advance
Posted
Comments
Jörgen Andersson 13-Oct-13 7:49am    
Can you post the exact error message?
RRiosV 14-Oct-13 11:47am    
It Says that "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

I noticed that i declared 2 cursors like this
VB
.Direction = ParameterDirection.Input
instead of this
VB
.Direction = ParameterDirection.Output


that was the underlying cause
Wonder why VS .NET doesn't give me the feedback about this error
 
Share this answer
 
Replace this Instead of
Dim ds As New DataSet()

in your first line of code to declare the dataset.
Dim ds As System.Nullable(Of DateSet) = New DataSet()
 
Share this answer
 
v2
Comments
RRiosV 14-Oct-13 11:49am    
it gets a syntax error, it says that dataset doesn't take null values

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900