Hallo to all VB programmers. . .I need help in viewing database using list. Please help me. . .I have this list of names in the database and I want to view it using listbox.

Thank you for the help. . .God Bless

Regards,
Neil

Recommended Answers

All 2 Replies

If your intention is just to view, then a recordset would do just fine. take a look at this:

Dim con As New ADODB.Connection
    Dim rec As New ADODB.Recordset
    Dim ConnStr As String
    Dim SQL As String
    ConnStr = "DSN=MyDatabase"
    SQL = "Select FirstName FROM ClassicNames"
    con.Open ConnStr, "DBUserName", "DBPassword"
    rec.Open SQL, con, adOpenStatic, adLockOptimistic
    Do While Not rec.EOF
        List1.AddItem rec.Fields("FirstName").Value
        rec.MoveNext
    Loop
    rec.Close
    con.Close

... you mean you want to add the names of the databases in the listbox? or the reply og rombusia is what you needed.

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.