ADO
Full reference for ADO and the SQL language can be found searching the Microsoft MSDN website.
Below is the VBscript code required to open a connection to a database and execute a SQL query.
It is extremely important to ensure that you always close database connections when you have finished with them - failure to do so can crash the entire webserver.
Your database DSN entry is created using your account control panel (assuming your account provides support for databases).
<%
Set dbConnection = Server.CreateObject("ADODB.Connection")
dbConnection.Open("Insert your DSN entry here...")
Set dbRecordset = dbConnection.Execute("Insert your SQL query here...")
Set dbRecordset = Nothing
dbConnection.Close
Set dbConnection = Nothing
%>
If you wish to use ADO contants by name (rather than by value), you will need to add the following Type Library reference to the top of your script:
<!--METADATA TYPE="typelib" NAME="ADODB Type Library" UUID="00000205-0000-0010-8000-00AA006D2EA4"-->
Click here to return to the previous page.
|