Creating Custom Search

To create Custom Search, we need to prepare our input text (for the keyword) and the search button :


Case : <INPUT type="text" ID="inpKeyword" NAME="inpKeyword" value="sorting">
<INPUT type="button" value="SEARCH" onclick="Search()">

Then we create Search() function that is called when user clicks the Search button. Within this function you can specify QueryString property with value from the input text as search criteria. Then we call getData() to request the data from the server. Here is the code :
function Search()
	{
	obj1.QueryString = "CaseDesc=" + inpKeyword.value;
	obj1.getData();
	}

You can find the code on page sample8.htm.

Here is the complete code :

<html>
<head>
	<link rel="stylesheet" type="text/css" href="include/WebGridEXP.css">
	<script language="JavaScript" src="include/WebGridEXP.js"></script>
	<script language="JavaScript">
	function Init()
		{
		obj1.COLUMNS    =	["TestID",
				"CaseDesc",
				"TestResult",
				"Comment",
				"NeedToFix"]
									
		obj1.IDENTITY   =	["TestID"]
							
		obj1.INPUTTYPES =	[Array("Text",255,false,false),
				Array("Text",255,true,true),
				Array("Text",255,true,true),
				Array("Text",255,true,true),
				Array("Boolean",true)]
							
		obj1.CAPTIONS   =	["ID",
				"Case Description",
				"Result",
				"Comment",
				"Need To Fix"]
							
		obj1.CELLWIDTH  =	[35,190,190,190,95]
		obj1.CELLHEIGHT =	100
				
		obj1.UrlGET     =	"dataGET/sampleGet8.asp" 
		obj1.UrlPOST    =	"dataPOST/samplePost1.asp" 
		obj1.ImgURL     =	"include"

		obj1.getData();
		}
		
	function Search()
		{
		obj1.QueryString = "CaseDesc=" + inpKeyword.value;
		obj1.getData();
		}
	</script>	
</head>
<body onload="Init()">


Case : <INPUT type="text" ID="inpKeyword" NAME="inpKeyword" value="sorting">
<INPUT type="button" value="SEARCH" onclick="Search()" ID="Button1" NAME="Button1">


<script>
var obj1 = new WebGridEXP("obj1")
</script>

</body>
</html>

On the server side, you need to add some codes to read the submitted criteria from the client (WebGrid EXP). After you get the criteria, you must construct SQL WHERE clause statement using the criteria. This is how you can implement the code :

sWHERE = ""
if Request.QueryString("CaseDesc") <> "" then
	sWHERE = " WHERE CaseDesc like '%" & Request.QueryString("CaseDesc") & "%' "
end if

You can find the code on page sampleGet8.asp.

Here is the complete code :


<%
Response.Buffer = True
Response.Expires = -1
Response.AddHeader "Pragma", "no-cache"
Response.AddHeader "cache-control", "no-store"

Class clsQuery
	
	Private sSQL
	Private sConnectString
	Private sPageSize
	Private sShowPage
	Private sOrderBy
	Private sOrderType
	Private arrExpression

	
	Public Property Let Expression(ByRef vVal)
		arrExpression = vVal
	End Property	

	Public Property Let SQL(ByRef vVal)
		sSQL = vVal
	End Property
	
	Public Property Let OrderBy(ByRef vVal)
		sOrderBy = vVal
	End Property	
	
	Public Property Let OrderType(ByRef vVal)
		if vVal = "" then 
			sOrderType = "ASC" 'default value
		else
			sOrderType = vVal
		end if		
	End Property
	
	Public Property Let ShowPage(ByRef vVal)
		if vVal = "" then 
			sShowPage = 1 'default value
		else
			sShowPage = CInt(vVal)
		end if
	End Property
	
	Public Property Let PageSize(ByRef vVal)
		if vVal = "" then 
			sPageSize = 10 'default value
		else
			sPageSize = CInt(vVal)
		end if
	End Property
	
	Public Property Let ConnectString(ByRef vVal)
		sConnectString = vVal
	End Property

	Public Function GetPage()
		
		sNewOrderBy = ""
		
		If sOrderBy <> "" Then
		
			Dim Item
			NumOfExps = 0
			if not IsEmpty(arrExpression) then
				For Each Item In arrExpression
					NumOfExps = NumOfExps + 1
				Next
			end if

			if NumOfExps>0 then
				For i = 0 to CInt(NumOfExps)-1
						sAlias = arrExpression(i)(0)
						sExp = arrExpression(i)(1)
						sNewOrderBy = replace(sOrderBy,sAlias,sExp)
				Next
				sSQL = sSQL & " Order By " & sNewOrderBy & " " & sOrderType
			else
				sSQL = sSQL & " Order By " & sOrderBy & " " & sOrderType
			end if

		End If	

		Dim rs
		Set rs = server.CreateObject("ADODB.Recordset") 
		rs.CursorLocation = 3
		rs.Open sSQL, sConnectString, 3, 1, &H0001

		Dim oXMLDOM
		set oXMLDOM = Server.CreateObject("MSXML.DOMDocument")	
		set oXMLDOM.documentElement = oXMLDOM.createElement("result")
		
		Dim root
		set root = oXMLDOM.documentElement		
		
		set oNode = oXMLDOM.createElement("Original")
		set oOriginal = root.appendChild(oNode)
		
		set oNode = oXMLDOM.createElement("PageProperty")'
		set oPageProperty = root.appendChild(oNode)
		
		If rs.RecordCount = 0 Then
			
			set oNode = oXMLDOM.createElement("ShowPage")'
			oNode.text = sShowPage
			oPageProperty.appendChild oNode  
				
			set oNode = oXMLDOM.createElement("PageSize")'
			oNode.text = sPageSize
			oPageProperty.appendChild oNode  		
				
			set oNode = oXMLDOM.createElement("NumOfPages")'
			oNode.text = 0
			oPageProperty.appendChild oNode  
				
			set oNode = oXMLDOM.createElement("OrderBy")'
			oNode.text = sOrderBy
			oPageProperty.appendChild oNode  	
				
			set oNode = oXMLDOM.createElement("OrderType")'
			oNode.text = sOrderType
			oPageProperty.appendChild oNode  			

			'GetPage = oXMLDOM.xml 
			set GetPage = oXMLDOM
				
			rs.Close
			Set rs = Nothing		
			Exit Function
		End If

		rs.PageSize = sPageSize
	    
		Dim NumOfPages
		NumOfPages = rs.PageCount
		If sShowPage < 1 then
			sShowPage = 1
		ElseIf sShowPage > NumOfPages Then
			sShowPage = NumOfPages
		End If
		rs.AbsolutePage = sShowPage

		Dim i
		i = 0
		Dim Field
		Dim oNode

							
		Do Until rs.EOF Or i = sPageSize

			set oNode = oXMLDOM.createElement("Row")
			oOriginal.appendChild oNode
					
			For each Field in rs.Fields 

				

				set oNode = oXMLDOM.createElement(Field.Name)
				if Not LenB(rs(Field.Name).Value)=0  Then
					if Field.type = 7 then 'date
						oNode.text = FormatDateTime(rs(Field.Name).Value,0)'kalau tdk pakai Cstr,format date bisa berubah
					else
						oNode.text = Cstr(rs(Field.Name).Value)'kalau tdk pakai Cstr,format date bisa berubah, toString
					end if					
					
				end if
				oOriginal.lastChild.appendChild oNode 
			Next
	        
			rs.MoveNext
			i = i + 1
		Loop
			
		set oNode = oXMLDOM.createElement("ShowPage")'
		oNode.text = sShowPage
		oPageProperty.appendChild oNode  
			
		set oNode = oXMLDOM.createElement("PageSize")'
		oNode.text = sPageSize
		oPageProperty.appendChild oNode  		
			
		set oNode = oXMLDOM.createElement("NumOfPages")'
		oNode.text = NumOfPages
		oPageProperty.appendChild oNode  
			
		set oNode = oXMLDOM.createElement("OrderBy")'
		oNode.text = sOrderBy
		oPageProperty.appendChild oNode  	
			
		set oNode = oXMLDOM.createElement("OrderType")'
		oNode.text = sOrderType
		oPageProperty.appendChild oNode  			

		'GetPage = oXMLDOM.xml 
		set GetPage = oXMLDOM

		rs.Close
		Set rs = Nothing
	End Function
	
End Class



Class clsPost

	Private sConnectString
	Private sTableName
	Private arrFieldList
	Private arrDataTypes
	Private arrPrimaryKeys
	Private arrPKDataTypes
	Private sFormatDate
	Private sDateSeparator
	
	Public Property Let ConnectString(ByRef vVal)
		sConnectString = vVal
	End Property
	
	Public Property Let TableName(ByRef vVal)
		sTableName = vVal
	End Property	
	
	Public Property Let FieldList(ByRef vVal)
		arrFieldList = vVal
	End Property	
	
	Public Property Let DataTypes(ByRef vVal)
		arrDataTypes = vVal
	End Property
	
	Public Property Let PrimaryKeys(ByRef vVal)
		arrPrimaryKeys = vVal
	End Property	
	
	Public Property Let PKDataTypes(ByRef vVal)
		arrPKDataTypes = vVal
	End Property
	
	Public Property Let FormatDate(ByRef vVal)
		sFormatDate = vVal
	End Property	
	
	Public Property Let DateSeparator(ByRef vVal)
		sDateSeparator = vVal
	End Property					
	
	Public Function Post()
		'*****************************************************************************
		'	Count Number Of Fields Array & Number Of Primary Keys Array
		'*****************************************************************************

		Dim Item
		NumOfArrFields = 0
		For Each Item In arrFieldList
			NumOfArrFields = NumOfArrFields + 1
		Next
		NumOfArrKeys = 0
		For Each Item In arrPrimaryKeys
			NumOfArrKeys = NumOfArrKeys + 1
		Next

		'*****************************************************************************
		'	GET SUBMITTED DATA
		'*****************************************************************************

		set cn = server.CreateObject("ADODB.Connection")
		cn.Open sConnectString

		Dim oDoc
		set oDoc = Server.CreateObject("MSXML.DOMDocument")
		oDoc.async = false
		oDoc.load(Request)

		set oNodeOriginal = oDoc.documentElement.selectSingleNode("YASP_Original")
		set oNodeModified = oDoc.documentElement.selectSingleNode("YASP_Modified")
		set oNodeDeleted = oDoc.documentElement.selectSingleNode("YASP_Deleted")
		set oNodeNew = oDoc.documentElement.selectSingleNode("YASP_New")

		'*****************************************************************************
		'	Prepare for error report
		'*****************************************************************************

		Dim domErr
		set domErr = Server.CreateObject("MSXML.DOMDocument")	
		set domErr.documentElement = domErr.createElement("ErrorReport")

		Dim domErrRoot
		set domErrRoot = domErr.documentElement	

		'*****************************************************************************
		'	UPDATE RECORDS
		'*****************************************************************************

		If oNodeModified.childNodes.length > 0 Then
			For i=0 to oNodeModified.childNodes.length-1 'FOR EACH RECORDS

				'UPDATE - STEP 1 : Construct field & value pairs
				sFieldValues = ""
				For j = 0 to CInt(NumOfArrFields)-1
					sField = arrFieldList(j)
					sType = arrDataTypes(j)
				
					Select case sType
						case "TEXT" :
							if Not IsNull(GetFieldValue(oNodeModified.childNodes(i),sField)) then
								if GetFieldValue(oNodeModified.childNodes(i),sField) = "" then 
									sFieldValues = sFieldValues & ", " & sField & " = null"
								else
									sFieldValues = sFieldValues & ", " & sField & " = '" & GetFieldValue(oNodeModified.childNodes(i),sField) & "'"
								end if
							end if	
						case "NUMBER" :
							if Not IsNull(GetFieldValue(oNodeModified.childNodes(i),sField)) then
								if GetFieldValue(oNodeModified.childNodes(i),sField) = "" then
									sFieldValues = sFieldValues & ", " & sField & " = null"
								else
									sFieldValues = sFieldValues & ", " & sField & " = " & GetFieldValue(oNodeModified.childNodes(i),sField)
								end if
							end if						
						case "DATE" :
							if Not IsNull(GetFieldValue(oNodeModified.childNodes(i),sField)) then

								if GetFieldValue(oNodeModified.childNodes(i),sField) = "" then
										sFieldValues = sFieldValues & ", " & sField & " = null" 'un
								else
										sDate = GetFieldValue(oNodeModified.childNodes(i),sField)
								
										sDatePart = split(sDate," ")(0)
										sTimePart = mid(sDate,len(sDatePart)+1) 'or 2
	
										d0 = split(sDatePart,sDateSeparator)(0)
										d1 = split(sDatePart,sDateSeparator)(1)
										d2 = split(sDatePart,sDateSeparator)(2)
										Select case sFormatDate
											case "ddMMyyyy","dMyyyy" :
												sDatePart = d1 & "/" & d0 & "/" & d2
											case "MMddyyyy","Mdyyyy" :
												sDatePart = d0 & "/" & d1 & "/" & d2
											case "yyyyMMdd","yyyyMd" :
												sDatePart = d1 & "/" & d2 & "/" & d0
										End Select
										if sTimePart <> "" then
											sFieldValues = sFieldValues & ", " & sField & " = #" & sDatePart & " " & sTimePart & "#"
										else
											sFieldValues = sFieldValues & ", " & sField & " = #" & sDatePart & "#"
										end if
								end if
								
							end if					
						case "BOOLEAN" : '(value must be -1/0 or true/false)
							if Not IsNull(GetFieldValue(oNodeModified.childNodes(i),sField)) then
								sFieldValues = sFieldValues & ", " & sField & " = " & GetFieldValue(oNodeModified.childNodes(i),sField)
							end if	
					End select
				Next
				sFieldValues = mid(sFieldValues,2)'Remove the first comma ","

				'UPDATE - STEP 2 : Construct primary key conditions
				sKeyFields = ""
				For j = 0 to CInt(NumOfArrKeys)-1
					sKey = arrPrimaryKeys(j)
					sType = arrPKDataTypes(j)

					Select case sType 'Type for Primary Key : TEXT, NUMBER
						case "TEXT" :
							if Not IsNull(GetKeyFieldValue(oNodeModified.childNodes(i),sKey)) then
								sKeyFields = sKeyFields & " AND " & sKey & " = '" & GetKeyFieldValue(oNodeModified.childNodes(i),sKey) & "'"
							end if	
						case "NUMBER" :
							if Not IsNull(GetKeyFieldValue(oNodeModified.childNodes(i),sKey)) then
								sKeyFields = sKeyFields & " AND " & sKey & " = " & GetKeyFieldValue(oNodeModified.childNodes(i),sKey)
							end if	
							
					End select			
				Next
				sKeyFields = mid(sKeyFields,5) 'Remove the first " AND"
				
				'UPDATE - STEP 3 : Construct SQL Statement
				SQL = "UPDATE " & sTableName & " SET " & sFieldValues & " WHERE " & sKeyFields

				'UPDATE - STEP 4 : Execute SQL Statement
				on error resume next
				cn.Execute SQL
				
				'UPDATE - STEP 5 : Construct Error Report
				if err<>0 then
						set oNode = domErr.createElement("Row")
						set domErrRow = domErrRoot.appendChild(oNode)			

						set oNode = oNodeOriginal.childNodes(i).cloneNode(true)
						set domErrOriginal = domErrRow.appendChild(oNode)	
						
						set oNode = oNodeModified.childNodes(i).cloneNode(true)
						domErrRow.appendChild(oNode)
						
						set oNode = domErr.createElement("SQL")
						set domErrSQL = domErrRow.appendChild(oNode)
						domErrSQL.text = SQL	
						
						set oNode = domErr.createElement("Action")
						set domErrAction = domErrRow.appendChild(oNode)
						domErrAction.text = "UPDATE"
						
						set oNode = domErr.createElement("Source")
						set domErrSource = domErrRow.appendChild(oNode)
						domErrSource.text = err.Source 
						
						set oNode = domErr.createElement("Number")
						set domErrNumber = domErrRow.appendChild(oNode)
						domErrNumber.text = err.number
						
						set oNode = domErr.createElement("Description")
						set domErrDescription = domErrRow.appendChild(oNode)
						domErrDescription.text = err.Description
						
						err.Clear 
				end if	
				
				
			Next
		End If

		'*****************************************************************************
		'	DELETE RECORDS
		'*****************************************************************************
		If oNodeDeleted.childNodes.length > 0 Then

			For i=0 to oNodeDeleted.childNodes.length-1 'FOR EACH RECORDS
			
				'DELETE - STEP 1 : Construct primary key conditions
				sFieldValue = ""
				if Not IsNull(GetFieldValue(oNodeDeleted.childNodes(i),"ID")) then
					sFieldValue = GetFieldValue(oNodeDeleted.childNodes(i),"ID")
				end if	
				
				'DELETE - STEP 1 : Construct primary key conditions
				sFieldValues = ""
				For j = 0 to CInt(NumOfArrKeys)-1
					sField = arrPrimaryKeys(j)
					sType = arrPKDataTypes(j)
					Select case sType 'Type for Primary Key : TEXT, NUMBER
						case "TEXT" :
							if Not IsNull(GetFieldValue(oNodeDeleted.childNodes(i),sField)) then
								sFieldValues = sFieldValues & " AND " & sField & " = '" & GetFieldValue(oNodeDeleted.childNodes(i),sField) & "'"
							end if	
						case "NUMBER" :
							if Not IsNull(GetFieldValue(oNodeDeleted.childNodes(i),sField)) then
								sFieldValues = sFieldValues & " AND " & sField & " = " & GetFieldValue(oNodeDeleted.childNodes(i),sField)
							end if						
					End select
				Next
				sFieldValues = mid(sFieldValues,5) 'Remove the first " AND"

				'DELETE - STEP 2 : Construct SQL Statement
				SQL = "DELETE FROM " & sTableName & " WHERE " & sFieldValues
					
				'DELETE - STEP 3 : Execute SQL Statement
				on error resume next
				cn.Execute SQL
				
				'DELETE - STEP 4 : Construct Error Report	
				if err<>0 then
						set oNode = domErr.createElement("Row")
						set domErrRow = domErrRoot.appendChild(oNode)			

						set oNode = oNodeOriginal.childNodes(i).cloneNode(true)
						set domErrOriginal = domErrRow.appendChild(oNode)	
						
						set oNode = domErr.createElement("Modified")
						domErrRow.appendChild(oNode)
						
						set oNode = domErr.createElement("SQL")
						set domErrSQL = domErrRow.appendChild(oNode)
						domErrSQL.text = SQL	
						
						set oNode = domErr.createElement("Action")
						set domErrAction = domErrRow.appendChild(oNode)
						domErrAction.text = "DELETE"
						
						set oNode = domErr.createElement("Source")
						set domErrSource = domErrRow.appendChild(oNode)
						domErrSource.text = err.Source 
						
						set oNode = domErr.createElement("Number")
						set domErrNumber = domErrRow.appendChild(oNode)
						domErrNumber.text = err.number
						
						set oNode = domErr.createElement("Description")
						set domErrDescription = domErrRow.appendChild(oNode)
						domErrDescription.text = err.Description
						
						err.Clear 
				end if
			Next
		End If

		'*****************************************************************************
		'	INSERT NEW RECORD
		'*****************************************************************************
		If oNodeNew.childNodes.length > 0 Then

			For i=0 to oNodeNew.childNodes.length-1

				'INSERT - STEP 1 : Construct fields & values
				sFields = ""
				sValues = ""
				For j = 0 to CInt(NumOfArrFields)-1
					sField = arrFieldList(j)
					sType = arrDataTypes(j)
					Select case sType
						case "TEXT" :
							if Not IsNull(GetFieldValue(oNodeNew.childNodes(i),sField)) then
								if GetFieldValue(oNodeNew.childNodes(i),sField) = "" then
									sFields = sFields & "," & sField
									sValues = sValues & ",null"
								else
									sFields = sFields & "," & sField
									sValues = sValues & ",'" & GetFieldValue(oNodeNew.childNodes(i),sField) & "'"
								end if
							end if	
						case "NUMBER" :
							if Not IsNull(GetFieldValue(oNodeNew.childNodes(i),sField)) then
								sFields = sFields & "," & sField
								if GetFieldValue(oNodeNew.childNodes(i),sField) = "" then
										sValues = sValues & ", null"
								else
										sValues = sValues & "," & GetFieldValue(oNodeNew.childNodes(i),sField)
								end if						
							end if	
						case "DATE" :
							if Not IsNull(GetFieldValue(oNodeNew.childNodes(i),sField)) then
								sFields = sFields & "," & sField
								if GetFieldValue(oNodeNew.childNodes(i),sField) = "" then
										sValues = sValues & ",null"
								else
							
										sDate = GetFieldValue(oNodeNew.childNodes(i),sField)
										sDatePart = split(sDate," ")(0)
										sTimePart = mid(sDate,len(sDatePart)+1) 'or 2

										d0 = split(sDatePart,sDateSeparator)(0)
										d1 = split(sDatePart,sDateSeparator)(1)
										d2 = split(sDatePart,sDateSeparator)(2)
										Select case sFormatDate
											case "ddMMyyyy","dMyyyy" :
												sDatePart = d1 & "/" & d0 & "/" & d2
											case "MMddyyyy","Mdyyyy" :
												sDatePart = d0 & "/" & d1 & "/" & d2
											case "yyyyMMdd","yyyyMd" :
												sDatePart = d1 & "/" & d2 & "/" & d0
										End Select
										
										if sTimePart <> "" then
											sValues = sValues & ",#" & sDatePart & " " & sTimePart & "#"
										else
											sValues = sValues & ",#" & sDatePart & "#"
										end if	
								end if							
							end if	
						case "BOOLEAN" : '(value must be -1/0 or true/false)
							if Not IsNull(GetFieldValue(oNodeNew.childNodes(i),sField)) then
								sFields = sFields & "," & sField
								sValues = sValues & "," & GetFieldValue(oNodeNew.childNodes(i),sField)
							end if					
					End select
				Next
				sFields = mid(sFields,2)'Remove the first comma ","
				sValues = mid(sValues,2)'Remove the first comma ","
				
				'INSERT - STEP 2 : Construct SQL Statement
				SQL = "Insert Into " & sTableName & " (" & sFields & ") VALUES (" & sValues & ")"

				'INSERT - STEP 3 : Execute SQL Statement
				on error resume next
				cn.Execute SQL
				
				'INSERT - STEP 4 : Construct Error Report	
				if err<>0 then
						set oNode = domErr.createElement("Row")
						set domErrRow = domErrRoot.appendChild(oNode)			

						set oNode = domErr.createElement("Original")
						domErrRow.appendChild(oNode)
						
						'set oNode = domErr.createElement("Modified")
						'domErrRow.appendChild(oNode)
						set oNode = oNodeNew.childNodes(i).cloneNode(true)
						domErrRow.appendChild(oNode)'Utk Insert error, apa yg di-insert dimasukkan ke  node "Modified"	
						
						set oNode = domErr.createElement("SQL")
						set domErrSQL = domErrRow.appendChild(oNode)
						domErrSQL.text = SQL	
						
						set oNode = domErr.createElement("Action")
						set domErrAction = domErrRow.appendChild(oNode)
						domErrAction.text = "INSERT"
						
						set oNode = domErr.createElement("Source")
						set domErrSource = domErrRow.appendChild(oNode)
						domErrSource.text = err.Source 
						
						set oNode = domErr.createElement("Number")
						set domErrNumber = domErrRow.appendChild(oNode)
						domErrNumber.text = err.number
						
						set oNode = domErr.createElement("Description")
						set domErrDescription = domErrRow.appendChild(oNode)
						domErrDescription.text = err.Description
						
						err.Clear 
				end if
			Next

		End If

		cn.Close 
		set cn = nothing
		
		set Post = domErr
		
	End Function


	'*****************************************************************************
	'	Generic Functions
	'*****************************************************************************
	Private Function GetFieldValue(oNode,FieldName)
		if oNode.getElementsByTagName(FieldName).length = 1 then
			if oNode.getElementsByTagName(FieldName)(0).attributes.length = 0 then 'get yg bukan identity (identity berarti ada attribute IsIdentity=true)
				GetFieldValue = FixSQL(oNode.getElementsByTagName(FieldName)(0).text)
			else
				GetFieldValue = null
			end if
		elseif oNode.getElementsByTagName(FieldName).length = 2 then '=2 berarti yg diedit adl identity
			GetFieldValue = FixSQL(oNode.getElementsByTagName(FieldName)(0).text)'yg pertama(0) = updated, yg kedua(1) = identity
		else
			GetFieldValue = null
		end if
	End Function
	
	Private Function GetKeyFieldValue(oNode,FieldName)
		if oNode.getElementsByTagName(FieldName).length = 1 then
			GetKeyFieldValue = FixSQL(oNode.getElementsByTagName(FieldName)(0).text)
		elseif oNode.getElementsByTagName(FieldName).length = 2 then '=2 berarti yg diedit adl identity
			GetKeyFieldValue = FixSQL(oNode.getElementsByTagName(FieldName)(1).text)'yg pertama(0) = updated, yg kedua(1) = identity
		else
			GetKeyFieldValue = null
		end if
	End Function	

	Private Function FixSQL(str)
		FixSQL =  Replace(str,"'","''")
	End Function

End Class
%> 
<%
sWHERE = ""
if Request.QueryString("CaseDesc") <> "" then
	sWHERE = " WHERE CaseDesc like '%" & Request.QueryString("CaseDesc") & "%' "
end if


Dim oQuery
Set oQuery = New clsQuery
oQuery.SQL = "SELECT TestID,CaseDesc,TestResult,Comment,NeedToFix FROM Test" & sWHERE
oQuery.ConnectString = "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & Server.MapPath("\database/grid.mdb")
oQuery.PageSize	= Request.QueryString("PageSize")
oQuery.ShowPage	= Request.QueryString("ShowPage")
oQuery.OrderBy	= Request.QueryString("OrderBy")
oQuery.OrderType = Request.QueryString("OrderType")

Response.ContentType = "text/xml"
Response.Write "<?xml version='1.0' encoding='ISO-8859-1'?>" & vbCRLF 
Dim oDoc
set oDoc = oQuery.GetPage()
Response.Write oDoc.xml
%>