0

I have been unsuccessful connecting to SQL server 2005 Express database from a Classic ASP site. In an attempt to locate error, I created an ASP.NET application and was able to connect and pull data using the same connection string without issue.

Dim mConnection

Set mConnection = Server.CreateObject ("ADODB.Connection")

mConnection.Open "Server=server;Database=database;UID=username;PWD=password"

PS. ASP site currently works on original system, so build and data is good (this is for new system).

Any suggestions?

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
Thomas
  • 1
  • 1

3 Answers3

1

You are not specifying the provider or driver:

Try:

Provider=SQLNCLI;Server=.\SQLEXPRESS;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

You would use .\SQLEXPRESS if the database is local or SERVERNAMEORIPADDRESS\SQLEXPRESS

ThatGuyInIT
  • 2,239
  • 17
  • 20
0

First suggestion would be not to be writing a new site in classic ASP. I believe that the object model may be different under classic ASP, and you may not have the right connection string for the model you are building under.

Where do you get an error, and what error do you get?

Schroedingers Cat
  • 3,099
  • 1
  • 15
  • 33
  • The site is already in production but the database is moving to a new system. The error I get is when attempting to access DB on site and get error roughly stating that the resources I am attempting to use are not available. Thank you – Thomas Jul 14 '11 at 19:20
0

Follow this example: http://www.cruto.com/resources/vbscript/vbscript-examples/misc/database/connect-to-a-sql-server-database.asp

PS: Sorry for the unformated text because I wrote this answer with ff 2.0 and Windows 98 as operatingsystem.

Toon Krijthe
  • 52,876
  • 38
  • 145
  • 202
Reporter
  • 3,897
  • 5
  • 33
  • 47
  • I do not believe it to be an issue with the connection string as much as a potential configuration issue on the server. Could something need to be enabled for Classic ASP to work? – Thomas Jul 14 '11 at 19:24
  • As far as I know not, but you have to wait until tomrrow for research. – Reporter Jul 14 '11 at 19:44
  • I asked a server administrator at my work and he said it could be an issue of IIS configuration. Also I found here an article about a similar topic: http://stackoverflow.com/questions/5769653/classic-asp-and-sql-server-express-2005. – Reporter Jul 15 '11 at 13:25