Hello,
Nope toujours une erreur mais elle a changé.
"Invalid connection string atribute"
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 30 31
| Dim Cn As ADODB.Connection
Dim Server_Name As String
Dim Database_Name As String
Dim User_ID As String
Dim Password As String
Dim SQLStr As String
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Server_Name = "MON_SERVEUR" ' Enter your server name here
Database_Name = "ANA" ' Enter your database name here
User_ID = "TOTO" ' enter your user ID here
Password = "TITI" ' Enter your password here
SQLStr = "SELECT * FROM MATABLE" ' Enter your SQL here
Set Cn = New ADODB.Connection
Cn.open "Provider=SQLOLEDB.1;Password=" & PassWord & ";Persist Security Info=True;User ID=" & User & ";Initial Catalog=" & Base & ";Data Source=" & Server
' Dump to spreadsheet
With Worksheets("Feuil2").Range("a1:z5000") ' Enter your sheet name and range here
.ClearContents
.CopyFromRecordset cn.execute(SQLStr)
End With
' Tidy up
rs.Close
Set rs = Nothing
Cn.Close
Set Cn = Nothing |
L'erreur est sur cette ligne :
Cn.open "Provider=SQLOLEDB.1;Password=" & PassWord & ";Persist Security Info=True;User ID=" & User & ";Initial Catalog=" & Base & ";Data Source=" & Server
Partager