Bei ActiveVB gibt es ein paar Tutorials, die unbedingt gelesen werden sollten: Der große ADO-Kurs, ADO, DB-Programmierung Const cstrSQLServer As String = "localhost"
Const cstrDatabase As String = "Users"
Const cstrUsername As String = "selber"
Const cstrPassword As String = "nopwd"
Set DB = New ADODB.Connection
With DB
.Provider = "SQLOLEDB.1"
.Properties("Persist Security Info").Value = False
.Properties("Initial Catalog").Value = cstrDatabase
.Properties("Data Source").Value = cstrSQLServer
.Properties("User ID").Value = cstrUsername
.Properties("Password").Value = cstrPassword
.Open
Debug.Print .ConnectionString
.Close
End With
Set DB = Nothing Listing 1: ADO-Connection für SQL Server Classic und MSDE |