Richard
Thu Jan 26 12:15:39 CST 2006
blinky44 wrote:
>I need some help with connecting to a SQL DB. From what I understand I
> use something like this:
>
> Dim RS
> Dim CN
>
> Set cn = Server.CreateObject("ADODB.Connection")
> Set rs = Server.CreateObject("ADODB.Recordset")
>
> objConnection.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source
> =C:\Online_Database\FE\Deadline DB.mdb;"
>
> But the last line should be for an SQL DB not an access one. I know
> this is a newbie question, but that is what I am! :)
Hi,
I use code similar to:
=========================
strDB = "TestDB"
strInstance = "MyInstance"
strConnect = "DRIVER=SQL Server;" _
& "Trusted_Connection=Yes;" _
& "DATABASE=" & strDB & ";" _
& "SERVER=" & strServer & "\" & strInstance
objConnection.ConnectionString = strConnect
objConnection.Open
========================
If you are using the default instance, it would be:
strConnect = "DRIVER=SQL Server;" _
& "Trusted_Connection=Yes;" _
& "DATABASE=" & strDB & ";" _
& "SERVER=" & strServer
--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab -
http://www.rlmueller.net