I am using VB.NET 2005 and SQL Server 2005. Using the Server object from SQL
Server Management Object (SMO), how can I connect to a database on the
server ?
When I do it like the following, it gave me an error "Logon failure: unknown
user name or bad password" even though the user id and password is correct.
Dim Server As Server = New Server("myServer")
Server.ConnectionContext.ConnectAsUser = True
Server.ConnectionContext.ConnectAsUserName = "myUserID"
Server.ConnectionContext.ConnectAsUserPassword = "myPassword"
Dim db As Database = Server.Databases("myDB") -Error here
Thank you.