Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to fill a VB.net ComboBox with Oracle database info (v. 11g)

Don_WilsonJul 7 2016 — edited Jul 13 2016

Hi Group,

I'm attempting to build a Visual Basic.net application that will gather it's information from our database.  My first task is to import to the application a list of rate plans into a combo box for the end user to search and select.  I've attempted the following VB.net commands to do this:

Note: I'm using Visual Studio Express 2015

        Dim conn As New Oracle.DataAccess.Client.OracleConnection()

        conn.ConnectionString = oraDB

        Dim sql As String = "select CRMRATESDW.RP.RP_ID" _

                            & "from CRMRATESDW.RP" _

                            & "where CRMRATESDW.RP.PROP_ID in ('" & propID & "')" _

                            & "And CRMRATESDW.RP.DW_RCRD_STS_CD in ('A')" _

                            & "Order by CRMRATESDW.RP.RP_ID"

        Dim command As New Oracle.DataAccess.Client.OracleCommand(sql, conn)

        command.CommandType = CommandType.Text

        Dim adapter As New Oracle.DataAccess.Client.OracleDataAdapter

        Dim ds As New DataSet()

        Dim i As Integer = 0

        Dim dr As Oracle.DataAccess.Client.OracleDataReader = command.ExecuteReader()

        Try

            conn.Open()

            adapter.SelectCommand = command

            adapter.Fill(ds)

            cmbxRatePlans.DataSource = ds.Tables(0)

            cmbxRatePlans.ValueMember = "PROP_ID"

            cmbxRatePlans.DisplayMember = "RP_ID"

            adapter.Dispose()

            command.Dispose()

            conn.Close()

            conn.Dispose()

        Catch ex As Exception

            MessageBox.Show("Can Not open connection ! ")

        End Try

The combo box (cmbxRatePlans) is not populating with anything.  While I'm not getting a runtime error, it isn't working.  Can someone offer a suggesting as to how to properly do this?

In advance, thanks for your help.

Don

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2016
Added on Jul 7 2016
5 comments
2,084 views