mdpepper 0 Newbie Poster

Hi guys! I am at the very end of a 3 month project and have encountered an issue right at the last hurdle.

I am using my companies content management system to display a web page. The web page is information regarding a certain species of animal, and the content will differ depending on what link it clicked and what variable is fed to the php script which will then connect to the db and retrieve relevant information. This varying information means that the page lengths will differ, therefore Ive written an asp script to retrieve the relevant page heights that I have manually entered to an online mssql database.

1. The cms is capable of handliing asp scripts.
2. The asp script works fine when I am running it outside the cms

so why on earth will this not connect to the database. The error message I get says that the sql server either doesnt exist (or something else, I cant remember because Ive left work now and am being tormented by this problem)

The upsetting thing is that the cms and the database are both stored on the same external server, but no matter if I use the server name or localhost the script will still fail when run from within the cms.

The code Ive used is below:

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=sqloledb;Data Source=SERVERNAME;Initial Catalog=DATABSE;User Id=USERID;Password=PASSWORD;"
strSql = "SELECT pageSizePixels FROM allAnimalGeneral where speciesID = 16"
Set rs = Conn.Execute(strSql)
If rs.eof Then
   Response.write("No records returned")
End If
   height = rs("pageSizePixels") 
   Response.write("Height: " & height)
Set Conn = Nothing
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.