Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fileds value
Message
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
Fileds value
Divers
Thread ID:
00895947
Message ID:
00895947
Vues:
54
Hi All:
I want to loop through the recordset and the the values for a field in my code,however when I execute my program, the record count is -1. I know I have at least seven records in my table. Below is my code. Can someone please show me how to loop through the records and extract the values for a given field in a table.

Thanks
MA

Dim oDataComm As ADODB.Connection
Dim oRecSet As New ADODB.Recordset

Dim i%, MaxFields%
Dim lPhone As String

' Make connection to DB
Set oDataComm = New ADODB.Connection
oDataComm.Connectionstring = "DSN=ctcore"
oDataComm.Open

oRecSet.Open "SELECT * FROM Phone", oDataComm
MaxFields = oRecSet.RecordCount ***I am getting Maxfields as -1***
For i = 1 To MaxFields
lPhone = oResSet.Recordset.Fields(i).Value
Next i


oRecSet.Close

oDataComm.Close
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform