How do I connect to MSSQL using Classic ASP

Please use the following connection string on our Windows 2012 servers to connect to the local MSSQL service

 "Provider=SQLOLEDB;Data Source=myServerAddress;UID=myUsername; PWD=myPassword; database=myDataBase;"

 Another method is to use a driver like so:

 "Driver={SQL Server Native Client 10.0};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;"

 

Note: The second method, with the driver, has shown some compatibility problems with some databases.

 In the above two examples, substitute the variables where:

 myDataBase and myUsername and myPassword are what you've already specified in the control panel under MSSQL databases. myServerAddress can be 'localhost' or you may need to specify '.\SQLEXPRESS'

 Lastly, if you are not sure how to use that in context of the code, you may use this sample code:

 

<connectionStrings>
<add name="connectionstring" connectionString="Initial Catalog=DATABASE-NAME;Data Source=localhost;User ID=USERNAME;Pwd=PASSWORD" />

* Replace DATABASE-NAME with the name of your database.
* Replace USERNAME with the user name you created for the database.
* Replace PASSWORD with the password of the database user.

</connectionStrings>

  • MSSQL using Classic ASP, How do I connect to MSSQL using Classic ASP
  • 10 Users Found This Useful
Was this answer helpful?

Related Articles

Ajax functionality is integrated in ASP .NET

To use Ajax,  login to your control panel. Click on Web Sites section. Click on the website...

ASP.NET TRUST LEVEL

We run ASP.NET in Full Trust Level

How to change SMTP port number?

To set up Microsoft Outlook Express:    Open Microsoft Outlook Express      Go to Tools >...

Can't receive mail but can send mail - Windows dedicated

If you are having problems receiving mail, you may be having a problem with the domain's disk...

Can't send mail but can receive - Windows dedicated

Usually when a user cannot send mail it is caused by a block on the Internet service provider's...