How to connect to MS SQL Server database

//connection to the database$dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with$selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB");

DSN stands for 'Data Source Name'. It is an easy way to assign useful and easily rememberable names to data sources which may not be limited to databases alone. If you do not know how to set up a system DSN read our tutorial How to set up a system DSN.

In the example below we will show you how to connect with a DSN to a MSSQL Server database called 'examples.mdb' and retrieve all the records from the table 'cars'.