You are Here: FAQWeb Space & AccessMSSQLArticle #3
How do I make a connection to a MSSQL Database using ASP?
Microsoft Packages Only!
In this guide, we already have a MSSQL database created named db123456789. Within this Access database there is one table named tbl_Sales. This table holds the data for recent sales by employees. Look below at the data in the database.
In this example, we will create an ASP script in VBScript to connect to the MSSQL database, print the price for each sale on the page as well as the total for all sales.
It is very important to close the connection once you are done querying the database. Only then will the memory resources be released. It is always good to have very minimum connections open.
Never under any circumstances use the following method to determine the number of lines received:
The system will have to go through the entire record and all its columns without using any of the data in there. This takes time, the page takes longer to load, and the database connection is open for longer (as already mentioned, there is a limit to the number of connections that can be open at the same time).
To find the number of row in a table, use the following code:
Disclaimer: 1&1 provides the scripts and related information on this page as a courtesy, subject to 1&1's General Terms and Conditions of Service (the "GT&C"). As set forth in more detail in the GT&C, the scripts and information are provided "as-is", without any warranty, and 1&1 is not liable for any damages resulting from your use of the scripts or information.
© 2012 1&1 Internet Ltd