hi friends,
i am using visula studio 2005 and database is sql server 2000. i have one table "Designation_Master" with two columns "DesigID" with datatype "smallint" and another "Designation" with datatype "Char(10)". i want to display both column in one row in combobox. i know concate the column. but i don't want to concate two columns. i need seprate two columns in combobox like datagrid or excel. please send a code in "vb" script language not in "c" or "C++"
thank u

so what you want it like? you want to show both of data in one combo box or each column for one combo box... maybe you can give the result what you it like to be...

i used this to load from sqlserver 2000

Private Sub ReadData()
        Dim i As Integer
        Dim cmdUser As New SqlCommand
        Dim daUser As New SqlDataAdapter
        Dim dsUser As New DataSet
        Dim dtUser As New DataTable
        Dim conn As SqlConnection

        conn = GetConnect()
        Try

            cmdUser = conn.CreateCommand
            cmdUser.CommandText = "SELECT * FROM User"
            daUser.SelectCommand = cmdUser
            daUser.Fill(dsUser, "User")
            dtUser = dsUser.Tables("User")
            For i = 0 To dtUser.Rows.Count - 1
                cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
            Next

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

call this procedure when form load (form load event)

for note :
cmbUserId.Items.Add(dtUser.Rows(i).Item(0))
this code will adapted with your database, in mydatabase id user in item(0) / first coloumn

ok.
hope this help

code above just for one combo box with one column you can change as u want.

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.