0

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

3
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by jireh
0

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
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.