I recently upgraded my computer from XP to Windows Seven. I was using IIS 6.0 but I am now on IIS 7.5. When I was on my XP machine I was able to get my Classic ASP pages running and viewable. I am working being ableto run a Classic ASP page from my local drive. I am using SQL Server 2005. I set up IIS 7.5 with an application pool with .NET Framework Version 2.0. When I try to run the page I get the error: “Microsoft OLE DB Provider for ODBC Drivers error ‘80004005’ [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified“. My code looks like this:
randomConnection = "Provider=SQLOLEDB;Data Source=server\instance;Initial Catalog=myDataBase;User Id=MyFakeUserID;Password=MyFakePassword;"
Set someRS = Server.CreateObject("ADODB.RecordSet")
mySQLStatement = "SELECT DISTINCT CarInfo.CarMake, CarInfo.CarColor FROM CarInfo"
someRS.Open mySQLStatement, randomConnection
The code errors out on the last line. My code has a lot more that it does after all this. All of the code worked fine with IIS 6.0. The only changes are I switched to Windows Seven 32-bit and IIS 7.5. Is there something special that needs down since I have IIS 7.5? I have created test ASP pages in the root directory without any database logic and the page rendered just fine.
Your connection string is using the wrong provider – SQLOLEDB is a data provider for SQL Server 2000 or SQL Server 7. You should be using SQLNCLI (or SQLNCLI10) according to SQL Server 2005 connection strings.
Try this…
Provider=SQLNCLI;Data Source=server\instance;Initial Catalog=myDataBase;User Id=MyFakeUserID;Password=MyFakePassword;You are also trying to open the connection using
mySQLStatementas the connection string. You need to revisit the documentation on how to connect and request data from ADODB.