
<% ' function.asp (03/06/01)
   
   ' This file is included to provide basic support for database
   ' connectivity in ASP.  In addition it contains a few constants
   ' that might need to be changed for your installation.

   ' These two objects are declared for use with any ADODB object
   ' They hold the connection settings (objConn) and the recordset
   ' (objRS) that are returned (globally) when a SQL statement is executed. %>

<% ' CONSTANTS AND GLOBAL VARIABLES

	Dim objConn, objRS
	'dsnstring = "DSN=ewebeditpro3"
	dsnstring = "DRIVER={SQL Server};SERVER=WEBSRV01;UID=web;pwd=w3bs1t3;DATABASE=content"
	cat_id = "1" ' Vacation in Florida Content Category
	default_page = "default.asp"
%>
<% Function DBConnect (SQL)
   ' The DBConnect function has one parameter (SQL), and performs the
   ' work of connecting to, and querying the database.  The results
   ' are in the named objects objRS

	' Define ADO object, and attribue Data Source Name (DSN) to that object
	' Alternatively you may use DSN-less connection, which maps the 
	' physical path for the database to the connection string
	
	Set objConn = Server.CreateObject("ADODB.Connection")
	'objConn.ConnectionString = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("ewebeditpro.mdb")
	'objConn.ConnectionString = "DSN=" & dsn
	objConn.ConnectionString = dsnstring


	objConn.Open	

	' Create record set and execute SQL command
	Set objRS = Server.CreateObject("ADODB.RecordSet")
	objRS.Open SQL, objConn
End Function %>


<% Function SQLFilter (Txt)
	'The SQLFilter function makes any string SQL safe, by
	'replacing single quotes with double quotes
	
	TXT = Replace(Txt, "'", "''")
	SQLFilter = TXT
End Function %>
 

<% Function DBClose
	'This function closes and destroys objects for the database.  It
	'should be called exactly once per page,
	
	objRS.Close
	objConn.Close
	
	Set objRS = Nothing
	Set objConn = Nothing
End Function %>

