PDA

Click to See Complete Forum and Search --> : ADO and Array


mml
Oct 20th, 2000, 12:16 AM
Hi,
New member here, also very new to VB. I am currently working on an application that reads and writes records from an .mdb file to an array. I am using an Active X control (ADO). I can't seem to write to the file and also can't seem to get the recordsets to display in the array. Have checked the connections, have bound the controls, have assigned the recordsource to the ADO control, plus a number of other things (including begging it to work!!). I am a bit stumped here as to where the problem lies. Maybe someone could help? At least point me in the direction as to where to begin to fix this problem. Will be more than happy to supply code, but don't know if it needs to come from the enter or load or neither?

I really need some assistance here, can anybody help? Please? Greatly appreciative!!!!

mml

makai
Oct 20th, 2000, 12:38 AM
this shows how to but data in a DBListbox
http://pages.about.com/vbmakai/ado4.htm

from the listbox it is easy to get it into an array

but if you really want to directly populate an array, you would normally open the database in code, loop through the records and take what you want from the fields

Oct 20th, 2000, 03:39 AM
I'll show you the fastest way


dim rs as new ADODB.Recordset,cn as new ADODB.Connection
Dim varResult as variant,strConn as string

strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Persist Security Info=False;" & _
"Data Source=" & App.Path + "\KoordNeu.mdb"

cn.Open strConnect
rs.open "Select * from Table",cn, adOpenStatic, adLockReadOnly

varResult=rs.Getrows
rs.close
set rs=nothing
set cn=nothing

varResult is a array with all Data from the Recordset