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开发者_如何学JAVA=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?
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
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?
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.
精彩评论