How to insert the Oracle 9i FIELD NAME into VB6.0 COMBO BOX

eg : desc customer;
This table have 3 fields : CustomerId, CustomerName & CustomerAddress

CombCust --> The above field names should be displayed while drop down of combo box

Thank you in advance

actually i never tried make a program with oracle before, but i already do this with sqlserver with vb.net:
maybe you can see the code and take the logic :

Private Sub StudentDataReader()
        Dim i As Integer
        Dim cmdStudent As New SqlCommand
        Dim daStudent As New SqlDataAdapter
        Dim dsStudent As New DataSet
        Dim dtStudent As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()
        Try

            cmdStudent = conn.CreateCommand
            cmdStudent.CommandText = "SELECT * FROM STUDENT"
            daStudent.SelectCommand = cmdStudent
            daStudent.Fill(dsStudent, "Student")
            dtStudent = dsStudent.Tables("Student")
            For i = 0 To dtStudent.Rows.Count - 1
                cmbNis.Items.Add(dtStudent.Rows(i).Item(0))

            Next

        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OKOnly, "Error Connection!!")
        End Try
        conn.Close()
    End Sub

the point of this code is the loop with for. sorry if this post can help u much but you can take the logic.

Thank JX_Man.

See my code - Can you find the Error in this code - I am using ADODB connection :-
--------------------------------------------------------
'this code calls the function GetQueryFields

Public Sub InitializeComboFromQueryFields(ByVal cbo As ComboBox, ByVal query As String, Optional ByVal allow_blank As Boolean = False)
Dim results As Collection
Dim i As Integer

' Execute the query.
Set results = GetQueryFields(query) <--------------------

' If we should allow blanks, start with a blank.
cbo.Clear
If allow_blank Then cbo.AddItem ""

' Initialize the ComboBox.
For i = 1 To results.count
cbo.AddItem results(i)
Next i
End Sub

--------------------------------------------------------

Public Function GetQueryFields(ByVal query As String) As Collection
Dim cn As New ADODB.Connection
Dim cm As New Command
Dim results As Collection
Dim rs As ADODB.Recordset
Dim field_num As Integer
Dim i As Integer
cn.Open " provider = MSDAORA; user id = scott; password = tiger;"

Set results = New Collection
rs.Open "select * from customer", cn, adOpenForwardOnly, adLockOptimistic

' Save the field names in the collection.
If rs.Fields.count > 0 Then
For i = 0 To rs.Fields.count - 1
results.Add (rs.Fields(i).Name)
i = i + 1
Next i
End If
' Close the Recordset.
rs.Close
' Return the collection.
Set GetQueryFields = results
End Function

The Error is on this line --> " rs.Open "select * from customer", cn, adOpenForwardOnly, adLockOptimistic ". (Run_time error : 91 Object variable or with block variable not set)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.