Entry
From a remote SQL client how can I connect to SQLServer7.0 through Internet;(Steps Please!)?
Mar 13th, 2005 15:29
Hossam Hossny, Subhasis Roy, http://www.keyz.info
Use the below VB sample code:
' Declare variables
Dim oServer As SQLDMO.SQLServer
Dim oLogin As SQLDMO.Login
' Create a server object and connect
Set oServer = CreateObject("SQLDMO.SQLServer")
oServer.Connect ("SERVERNAME")
' Create the Login object
Set oLogin = CreateObject("SQLDMO.Login")
' Set the appropriate properties
oLogin.Name = "Bob"
oLogin.Type = SQLDMOLogin_Standard
oLogin.SetPassword "","password"
' Add the Login object to the server's Logins collection
oServer.Logins.Add oLogin
Please note that the fields between < > should be modified according to
your SQL server configurations.
Cheers,
Hossam Hossny
http://www.keyz.info