ASP to MSSQL connection Print

  • 46

Before you can access your MS-SQL Server database from your ASP code , you need to connect to it using one of the following available methods:

Connect to a MS-SQL Server database with MS-SQL Driver:

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Driver={SQL Server};" & _
"Server=(SERVERNAME);" & _
"Database=your_database_name;" & _
"Uid=your_username;" & _
"Pwd=your_password;"
objConn.Close
Set objConn = Nothing

 

Remeber to change the (SERVERNAME) to match your connection string
for example if you mssql hostname is:   sqlserver.webhost4asp.com,777

then you have to change the string from
Server=(SERVERNAME);
to
Server=sqlserver.webhost4asp.com,777;


Was this answer helpful?

« Back