hi all,
this my question again..
i need to load data from database and it will show in combo box.
if i want to load id_user from database i will get all id user fill the combo box item, so i can choose the user. how can i do this? really need help.

thx all,

Recommended Answers

All 3 Replies

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()

            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

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

call this procedure when form load (form load event)

for note :
this code will adapted with your database, in mydatabase id user in item(0) / first coloumn

hope this help

commented: thanks +1

hi jx_man,
thx again for your best reply..
this code really help me much.

Hi I am using sql 2005 and I have got same doubt so please help me

Be a part of the DaniWeb community

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