Results 1 to 3 of 3

Thread: Getting.... Tired of asking.. and asking and asking..

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184

    Angry

    Everytime I seem to ask...
    I seem to get little responce...
    I cant get any of the responces to work
    that I do have.. so im gonna ask again..

    I need a row of a DB put in a array..
    Can someone make me a lil test project that
    puts a Row of a DB in a Array and sent it
    to [email protected] ??!
    The code ive been using does not work at all!


    This is the code I was given....

    --------------------------------------------------------------------------------
    Private Sub Command1_Click()
    Dim cn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim arrRec As Variant

    cn.Provider = "Microsoft.Jet.OLEDB.4.0"
    cn.Open "E:\ClientAlert\clients.mdb"

    rs.Open "Select [Closing Date] From Clients", cn, adOpenStatic

    If Not rs.EOF Then
    arrRec = rs.GetRows
    End If

    rs.Close
    Set rs = Nothing
    cn.Close
    Set cn = Nothing
    End Sub
    --------------------------------------------------------------------------------

    Would someone please send me a little test program
    that works .. that does this??


    Evan Duffield --------
    --- [email protected]
    - -
    VB6 - Learning Edition
    - -


  2. #2
    Lively Member
    Join Date
    Apr 2000
    Location
    Rafaela (Argentine)
    Posts
    107
    Try passing the number of rows you want to process as a parameter to the GetRows function, this way (by example):

    Code:
    arrRec = rs.GetRows(10)

  3. #3
    Guest
    Try this,
    ' Create a connection Object
    Dim cnnAccessDatabase As ADODB.Connection
    Set cnnAccessDatabase = New ADODB.Connection
    ' Create a recordset
    Dim rsLog As ADODB.Recordset
    Set rsLog = New ADODB.Recordset
    Dim sSQL As String
    ' Open datasource. Change name to your database
    cnnAccessDatabase.Open "Provider=Microsoft.Jet.OLEDB.4.0;Password="""";Data Source=C:\Databases\log.mdb;Persist Security Info=True"
    ' Set Active Connection
    rsLog.ActiveConnection = cnnAccessDatabase
    sSQL = "SELECT * FROM myTable ORDER BY ID"
    rsLog.Open sSQL, cnnAccessDatabase, adOpenKeyset, adLockBatchOptimistic
    ' Get data from recordset
    arrRec = rsLog.GetRows


    ' Close and Clean Up
    Set rsLog.ActiveConnection = Nothing
    cnnAccessDatabase.Close
    Set rsLog = Nothing
    Set cnnAccessDatabase = Nothing


    Imar

    [Edited by Imar on 04-20-2000 at 01:10 AM]

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