Opening the Local SQL Server
Written by Eric Smith, Northstar Computer Systems LLC
I move code back and forth between my development and production machines, and one thing I always had to change was what the server's name was. However, by changing the Data Source a bit, you can always point to the SQL Server installation on the current machine. Here's an example:
Set cnDB = Server.CreateObject("ADODB.Connection")
cnDB.ConnectionString = "Provider=SQLOLEDB;" _
& "Data Source=(local);" _
& "Initial Catalog=Northwind;" _
& "User ID=sa;" _
& "Password=;"
cnDB.Open
By using the value (local) as the Data Source, it will point to the local installation. This is similar to how the SQL Server Query Analyzer works…it always gives you the choice of (local) to point to the local machine.
Keywords: [
Active Data Objects
]
Publication Date: 11/1/2000
|