|
-
Mar 29th, 2006, 05:44 PM
#1
Thread Starter
Addicted Member
Ado.net
i would like to know if somebody could help me to convert these codes to ADO.NET:
Private Sub X()
Dim adoRecordset As ADODB.Recordset
Dim i As Long
Dim a As Long
Dim Totals() As Long
Set adoRecordset = New ADODB.Recordset
With adoRecordset
.CursorType = adOpenForwardOnly
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.ActiveConnection = connImport
.Open "SELECT Count([Field]) FROM [Table]"
i = .Fields(0)
.Close
End With
ReDim Totals(i)
For a = 1 To i
With adoRecordset
.Open "SELECT SUM([Field]) FROM [Table] WHERE [Field] IN (SELECT TOP " & a & " [Field] FROM [Table])"
Totals(a) = .Fields(0)
.Close
End With
Next
Set adoRecordset = Nothing
For a = 1 To i
MsgBox Totals(a)
Next
End Sub
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
|