[script library]

Here is popular sample code for programmers using server side scripting. To view a list of server properties, point your browser to the relative URL of "/Scripts/Properties.asp" on your web site.


Accessing SQL Server

Purpose:

Connect to and open a SQL Server database without using ODBC DSNs

Usage:

<!-- #include virtual="/Scripts/Includes/adoJavaS.inc" -->
var objCONN = Server.CreateObject( "ADODB.Connection" );
objCONN.Open( "Provider=SQLOLEDB;Server=MAYWOOD-IS-0004;Trusted_Connection=yes;Database=database" );
var objRS = Server.CreateObject( "ADODB.Recordset" );
objRS = objCONN.Execute( "Select * From [table];", null, adCmdText );
' Process the database records here 
objRS.Close();
objCONN.Close();

Accessing a Database in Microsoft MS-Access Format

Purpose:

Connect to and open an MS-Access database without using ODBC DSNs

Usage:

<!-- #include virtual="/Scripts/Includes/adoJavaS.inc" -->
var objCONN = Server.CreateObject( "ADODB.Connection" );
var pathDB = Server.MapPath( "/_private/database.MDB" );
objCONN.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pathDB + ";" );
var objRS = Server.CreateObject( "ADODB.Recordset" );
objRS = objCONN.Execute( "Select * From [table];", null, adCmdText );
' Process the database records here 
objRS.Close();
objCONN.Close();   

Sending Electronic Mail

Purpose:

Send email from a script

Usage:

var objMail = Server.CreateObject( "CDONTS.Newmail" );
objMail.Importance = 0;
objMail.From = "Your Name<Your_Name@Your_Domain.tld>";
objMail.To = "Their Name<Their_Name@Their_Domain.tld>";
objMail.Subject = "topic";
objMail.Body = "First Line\n" + "Second Line\n";
objMail.Send();
objMail = null;


This page was last updated on 08/01/99 12:46:43 AM.
1998, 1999,  H&M Systems Software,  Inc.