|
-
Apr 19th, 2000, 01:17 AM
#1
Thread Starter
Addicted Member
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??
-
Apr 19th, 2000, 01:42 AM
#2
Lively Member
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)
-
Apr 19th, 2000, 05:59 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|