Link to home
Start Free TrialLog in
Avatar of tabing16
tabing16

asked on

copy file into listbox

how can i copy the record (e.g. Street Name field) in the database into the listbox ?
Avatar of carloss
carloss

Here's a sample:

Dim rsList as ADODB.Recordset

Set rsList = new ADODB.Recordset

With rsList
.Open "SELECT CompanyName FROM Customers", "PROVIDER=SQLOLEDB;Integrated Security=SSPI;DATABASE=Northwind;SERVER=(local)", adOpenForwardOnly, adLockReadOnly, adCmdText

While Not(.EOF)
lstNames.AddItem .Fields(0).Value
.MoveNext
Wend
End With
Avatar of tabing16

ASKER

I'm sorry, let me correct my question...i had succeeded to load the database field (Street Name field) into the listbox, i  did the random function to the field using SQL statement, but the problem is it was sequential random, what i want is a random result that is different everytime I start the application, and one more problem is i could not put randomize keyword inside the SQL statement, is there anyway to do random function outside the SQL statement but affect the result ot Street Name and put the random result into the listbox ?
ASKER CERTIFIED SOLUTION
Avatar of carloss
carloss

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial