How to connect to MS SQL Server database
Below is the code for connecting to a MSSQL Server database.
Connect with a DSN
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'.
Connect without a DSN (using a connection string)
Let see a sample script to see how ADODB is used in PHP:
To create 'examples' database on your MSSQL Server you should run the following script:
|Copyright © 2005-2007 www.WebCheatSheet.com All Rights Reserved.|