Results 1 to 3 of 3

Thread: ADO and Array

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Location
    Posts
    1

    Unhappy

    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
    mml
    student/e-commerce

  2. #2
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    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

  3. #3
    Guest
    I'll show you the fastest way

    Code:
      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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width