Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help me in Coding
Message
 
À
24/06/2000 08:42:59
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00383042
Message ID:
00384261
Vues:
37
I did some simple test and I got it!!!

Here is the code you pasted here (I added a grid to ensure that the connection is good and I changed the database).
Option Explicit

Private Logincn As ADODB.Connection
Private mrstData As ADODB.Recordset

Private Sub Command1_Click()
    Set Logincn = New ADODB.Connection
    With Logincn
    .Provider = "Microsoft.Jet.OLEDB.3.51"
    .ConnectionString = "D:\Projets VB\Nwind.Mdb"
    .Open
    End With
    
    Set mrstData = New ADODB.Recordset
    mrstData.Open "SELECT * FROM Employees", Logincn, adOpenStatic, adLockReadOnly
    Set DataGrid1.DataSource = mrstData
End Sub

Private Sub Command2_Click()
    Set Logincn = New ADODB.Connection
    With Logincn
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "D:\Projets VB\Nwind.Mdb"
    .CursorLocation = adUseClient
    .Open
    End With

    Set mrstData = New ADODB.Recordset
    mrstData.Open "SELECT * FROM Employees", Logincn, adOpenStatic, adLockReadOnly
    Set DataGrid1.DataSource = mrstData
End Sub
The only thing that was missing in your "New Code" was
.CursorLocation = adUseClient
I don't know why but his seems to have an importance with this version of the provider!
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform