1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
Dim cnx As ADODB.Connection
Set cnx = New ADODB.Connection
Dim rst As Recordset
'Définition de la chaîne de connexion
cnx.ConnectionString = "UID=sa" & ";PWD=sql" & ";" & "DRIVER={SQL Server};Server=monserver" & ";Database=mabase" & ";"
'Ouverture de la base de données
cnx.Open
If cnx.State = 1 Then
MsgBox ("Connection Opened")
Else
MsgBox ("Connection Failed")
End If
rst.Open "SELECT * FROM matable", cnx
rst.MoveFirst
While Not (rst.EOF)
MsgBox ("test")
rst.MoveNext
Wend |
Partager