<!--#include file="../../owFunctions/I_GeneralFunctions.asp"-->
<!--#include file="../header.asp"-->
<%
	'************************************************************************************
	'*																					*
	'*	MODIFICATION TO THIS SCRIPT OR ANY FILES INCLUDED WITH 							*
	'*		ONEWORLDSTORE IS DONE AT YOUR OWN RISK!										*
	'*	Product  : OneWorldStore														*
	'*	Version  : 9.0000																*
	'*	Modified : June 2004															*
	'*	Copyright:	Copyright (C) 2004 OneWorldStore.Com								*
	'*				Registration Number: 1024507										*
	'*				http://strategis.ic.gc.ca/											*
	'*																					*
	'************************************************************************************
	
	%>
	<body style="font-family: Arial; font-size: 11px" topmargin="0" leftmargin="0" bgcolor=C3DAF9>
		<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>
			<tr>
				<td valign=top>
					<%Call DisplayResults()%>
				</td>
			</tr>
		</table>
	<%
	
	
	'************************************************************************************
	'*																					*
	'*																					*
	'*																					*
	'************************************************************************************
	Sub DisplayResults()
	
		dim iPosition, sMessage
		
		iPosition = 0
		
		If ( bOWBackOfficeDemoMode ) Then
			Response.Write LANG_DT( "DISABLED_IN_DEMO", "Function disabled in demo mode." )
		Else
			sSQLTextLow	= lcase(Request("sSQLText"))
			sSQLText	= Request("sSQLText")
			
			If ( sSQLText = "" ) Then
				Response.Write LANG_DT( "GENERICSQL_ENTERSELECT", "Please enter a Query." )
			Else
				If ( ( InStr(sSQLTextLow,"update") > 0 ) Or ( InStr(sSQLTextLow,"insert") > 0 ) Or ( InStr(sSQLTextLow,"delete") > 0 ) Or ( InStr(sSQLTextLow,"alter") > 0 ) Or ( InStr(sSQLTextLow,"drop") > 0 ) ) Then
					Response.Write LANG_DT( "GENERICSQL_DISABLED", "Please only enter SELECT SQL Queries." )
				Else
					Call DB_getFromDatabase(sSQLText, rsStoreData, "")
					If ( err.number <> 0 ) Then
						Response.Write LANG_DT( "GENERICSQL_ERROR", "Unable to run SQL Query:<br><br>" ) & err.Description
					Else
						If ( NOT rsStoreData.EOF ) Then
							%>
							<%=LANG_DT( "QUERY", "Query" )%>: <b><%=sSQLText%></b><br><br>
							<table border="0" cellpadding="5" cellspacing="0" width="100%" style="FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #808080" bgcolor="#ffffff">
								<%
								While ( NOT rsStoreData.EOF )%>
									<tr>
									<%
									For Each sDBField In rsStoreData.Fields
										If ( sDBField.Name <> "" ) Then
											If ( iPosition = 0 ) Then
												Response.Write "<td bgcolor=EAF1F9 style='border-right: 1px solid #AAAAAA; border-bottom: 1px solid #AAAAAA;'><b>" & sDBField.name & "</b></td>"
											Else
												Response.Write "<td style='border-right: 1px solid #AAAAAA;'>" & rsStoreData(sDBField.name) & "&nbsp;</td>"
											End If
										End If
									Next
									%>
									</tr>
									<%
									iPosition = iPosition + 1
									rsStoreData.MoveNext
								Wend
								%>
							</table>
							<%
						Else
							%>
							<br><%=LANG_DT( "GENERICSQL_NORESULTS", "No results were returned with your query." )%>
							<br>
							<%=sSQLText%>
						<%End If
					End If
				End If
			End If
		End If
								
	End Sub
	'************************************************************************************
	%>
	<!--#include file="../footer.asp"-->