VAIOWEB Domain Names Registration, Linux Web Hosting, Email Hosting, Reseller Hosting, VPS Hosting, Thawte Digital SSL Certificates, WebSite Builder, WebSite Templates

ASP Script to Test MSSQL Database Connectivity

Provided below is a simple ASP script to test MSSQL database connectivity.

Sample Script

        <%
        Set cn = Server.CreateObject("ADODB.Connection")
        cn.Open "Provider=SQLOLEDB;Server=<MSSQL Server IP>;Database=<Database Name>;UID=<Database User>;PWD=<Database User Password>;"
        cn.CommandTimeout = 900
        cn.Close
        Response.write("Connected Successfully")
        %>

Explanation about the variables used in the script:

  • Server: The MSSQL Server IP needs to be mentioned.

  • Database: Specify exact database name. For example, reseloaq_mssql.

  • UID: Mention the database user associated with the database.

  • PWD: Mention the password for the above database user.