Connection string

He has: 18 posts

Joined: Jul 2005

Hi all. I am running MS Server 2003 and IIs 6.1. MSSQL server 2000 sp 3a. I am using this connection string

Set dcnDB = Server.CreateObject("ADODB.Connection")
dcnDB.open "PROVIDER=SQLOLEDB;DATA SOURCE=cfc-webserver2;DATABASE=cfcPublicSite"

and am unable to make a connection. Is that the correct connection string for the listed server?

He has: 18 posts

Joined: Jul 2005

Here is the entire script from the page, if any of you see anything wrong with it, please let me know

<?php
Option Explicit
Dim StoryID
Dim dcnDB
Dim strSQL
Dim rsfeature
Dim rsmedia
Dim rsLeadership
Dim rsMilitary
Dim rsExternal
Dim rsCommunications
Dim rsRight
Dim rsHeadline
Dim rsTop
Dim rsFooter
Dim rsPhoto
Dim rsStory
Dim ID
Dim rsNewcomers


IF Session ("Banner") = "" Then
Response
.Redirect("security.asp")
End IF

StoryID = Request.QueryString("StoryID")

Set dcnDB = Server.CreateObject("ADODB.Connection")
dcnDB.open "PROVIDER=SQLOLEDB;DATA SOURCE=cfc-webserver2;DATABASE=cfcPublicSite"

strSQL = "SELECT * FROM Links " _
   
& "WHERE Feature = 1 " _
   
& "ORDER BY LinkPriority"
Set rsfeature = dcnDB.Execute(strSQL)

strSQL = "SELECT * FROM Links " _
   
& "WHERE media = 1 " _
   
& "ORDER BY LinkPriority"
Set rsmedia = dcnDB.Execute(strSQL)

strSQL = "SELECT * FROM Links " _
   
& "WHERE Newcomers = 1 " _
   
& "ORDER BY LinkPriority"
Set rsNewcomers = dcnDB.Execute(strSQL)

strSQL = "SELECT * FROM Links " _
   
& "WHERE Leadership = 1 " _
   
& "ORDER BY LinkPriority"
Set rsLeadership = dcnDB.Execute(strSQL)

strSQL = "SELECT * FROM Links " _
   
& "WHERE Military = 1 " _
   
& "ORDER BY LinkPriority"
Set rsMilitary = dcnDB.Execute(strSQL)

strSQL = "SELECT * FROM Links " _
   
& "WHERE External = 1 " _
   
& "ORDER BY LinkPriority"
Set rsExternal = dcnDB.Execute(strSQL)

strSQL = "SELECT * FROM Links " _
   
& "WHERE Communications = 1 " _
   
& "ORDER BY LinkPriority"
Set rsCommunications = dcnDB.Execute(strSQL)

strSQL = "SELECT TOP 10 * FROM Stories " _
   
& "WHERE Headline = 0 " _
   
& "ORDER BY StoryID DESC"
Set rsRight = dcnDB.Execute(strSQL)

strSQL = "SELECT * FROM Links " _
   
& "WHERE Footer = 1 " _
   
& "ORDER BY LinkPriority"
Set rsFooter = dcnDB.Execute(strSQL)

strSQL = "SELECT * FROM Links " _
   
& "WHERE Header = 1 " _
   
& "ORDER BY LinkPriority"
Set rsTop = dcnDB.Execute(strSQL)

If
StoryID = "" Then
strSQL
= "SELECT * FROM Stories " _
    
& "WHERE Headline = 1 " _
    
& "ORDER BY StoryID DESC"
Set rsHeadline = dcnDB.Execute(strSQL)

ID = rsHeadline("StoryID")

strSQL = "SELECT Top 2 * FROM Photos " _
       
& "WHERE StoryID = " & ID
Set rsPhoto
= dcnDB.Execute(strSQL)

Else

strSQL = "SELECT * FROM Stories " _
    
& "WHERE StoryID = " _
    
& StoryID _
    
& "ORDER BY StoryID DESC"
Set rsStory = dcnDB.Execute(strSQL)

strSQL = "SELECT Top 2 * FROM Photos " _
       
& "WHERE StoryID = " & StoryID
Set rsPhoto
= dcnDB.Execute(strSQL)
End If
?>

They have: 222 posts

Joined: Sep 1999

I've never tried using DCNs to connect. This method has worked for me before:

dim objDBConn ' database connection object
dim objRS ' record set

' Create connection and recordset
Set objDBConn = Server.CreateObject("ADODB.Connection")
objDBConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\_clients\theclient.com\www\database\theclient.mdb"
Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open "SELECT TOP 1 jrnl_id FROM tbl_jrnl ORDER BY jrnl_id DESC", objDBConn

Set objRS = Nothing
objDBConn.Close
Set objDBConn = Nothing
'

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.