Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Fill: SelectCommand.Connection property has not been initialized.

$
0
0

please help I have error on the exception : Fill: SelectCommand.Connection property has not been initialized.

below is my code

Imports System.Configuration
Imports System.Data.OracleClient
Imports clsLibrary.modPublic

Public Class GET_BENEFITS
    Public Function FillBenefits(ByVal Country As String, ByVal POLICY As System.Nullable(Of Integer), _
            ByVal SC_PPAs String) As BenefitsData
        Dim Bata As BenefitsData
        Dim cmdMain As New OracleClient.OracleCommand()
        Dim dtMain As New DataTable()

        Try

            Dim conn As New OracleConnection
            conn.ConnectionString = ConfigurationManager.ConnectionStrings("CnnStr").ToString()
            conn.Open()

            cmdMain.CommandText = " SELECT DISTINCT SC_CODE, SC_SEQ, POLICY_END, SC_INC, SC_EXP, SC_SUMIY " & _
                              " FROM   SS_POLMEDRISK                                                 "
         
            Dim da As New OracleDataAdapter(cmdMain)
            da.Fill(dtMain)

            '   Return dtMain


            'cmdMain.Connection = conn
            'Dim dr As OracleDataReader = cmdMain.ExecuteReader()
            'dr.Read()
            'Cdata.ConditionDesc = dr.Item(0)
            'cmdMain.Parameters.Clear()


            'Return Cdata
        Catch ex As Exception
            ex.Message.ToString()
            cmdMain.Parameters.Clear()

            Return Nothing
        End Try

    End Function


End Class

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>