'-------------------------------------------------------------------------------------
' FunctionToPullASingleDataField
' ---------------------
' Pulls a single data field and returns that field
'
'EXAMPLE USAGE: Response.Write FunctionToPullASingleDataField("default")
'----------------------------------------------------------------
Function FunctionToPullASingleDataField(strParmeterPassedIn)
Dim strSQL '// your SQL statement to tell the database what data you want.
Dim arrRS '//this will hold the array of data returned from the database
Dim strOutput '//this variable will hold the output. In case you need to fuss with it before returning.
'// define the SQL statement you will feed to the database
strSQL = "SELECT PG_HEADER FROM TBLPAGES WHERE PG='"&strParmeterPassedIn&"'"
'//Use a special PilotCart only function to open the database
'/ this function either returns an array, or NULL
arrRS = OpenArrayRS(strSQL) '//passing it the SQL statement you constructed
'//Check the connection contains data of some sort
If NOT IsNULL(arrRS) Then
'//Grab the data
'// See another post on how to know what numbers to put here.
strOuptut = arrRS(0,0)
'//Close the object containing the data so the server doesn't crash later
Erase arrRS
Else
strOuptut = "Sorry Nothing Was Found"
End If
'//All functions have to return data. This is where we make the variable strOutput
'/ be the returned value
FunctionToPullASingleDataField = strOuptut
End Function
<%
Chris Zwemke
chris @ scarabmedia . com
www.pilotcart.com
%>