Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Parameterized query results in Grid DTC

Status
Not open for further replies.
Jul 17, 2002
22
US
On my ASP page I have a parameterized Sql query that is to display the results in the DTC grid. But I don't know how to get the information in grid. On the properties page of the grid I specify the Recordset as objrs and Field/Expression to "=objrs("Room")" etc. But id does not display anything. Once being displayed I need the user to be able to select the record and run a Delete query.

This is the code I have so far. Any assistance would be gratly appreciated.



<%@ Language=VBScript %>
<SCRIPT id=DebugDirectives runat=server language=javascript>
// Set these to true to enable debugging or tracing
@set @debug=false
@set @trace=false
</SCRIPT>
<% ' VI 6.0 Scripting Object Model Enabled %>
<!--#include file=&quot;_ScriptLibrary/pm.asp&quot;-->
<% if StartPageProcessing() Then Response.End() %>
<FORM name=thisForm METHOD=post>
<% dim objrs
dim objrs1

set objconn = server.createobject(&quot;adodb.connection&quot;)
objconn.Open session(&quot;connectionstring&quot;)


sub search
'Sql statement that finds the rooms that are reserved
' in the reservation table for a particular Requestor
sql = &quot;SELECT reservation.room, reservation.dateR, &quot;&_
&quot;reservation.start_time, reservation.end_time &quot;&_
&quot;FROM Reservation &quot;&_
&quot;WHERE reservation.requestor = '&quot; &Request.QueryString(&quot;requestor&quot;)&&quot;'&quot;

set objrs = server.createobject(&quot;adodb.recordset&quot;)
objrs.open sql, objconn, 0 ,1 ,1


do until objrs.EOF
%> <tr><td><td><td><td><td><td> <%=objrs(&quot;Room&quot;)%>
<td><td><td><td><td><td><td><td><td><td><td> <%=objrs(&quot;DateR&quot;)%>
<td><td><td><td><td><td><td><td><td><td><td><td><td> <%=mid(objrs(&quot;Start_Time&quot;),10,7)%>
<td><td><td><td><td><td><td><td><td><td><td><td><td> <%=mid(objrs(&quot;End_Time&quot;),10,7)%>
<%objrs.MoveNext
loop

objrs.Close

end sub

%>
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
</HEAD>
<BODY bgColor=skyblue>
<table border=1 align=center style=&quot;HEIGHT: 43px; WIDTH: 600px&quot;>
<TBODY>
<tr><td colspan=4>
<td align=middle><strong> Room </strong>
<td align=middle><strong> Date </strong>
<td align=middle><strong> Start Time </strong>
<td align=middle><strong> End Time </strong>
</td></tr></TBODY>

'the following id the Grid DTC code
<!--METADATA TYPE=&quot;DesignerControl&quot; startspan
<OBJECT classid=&quot;clsid:277FC3F2-E90F-11D0-B767-0000F81E081D&quot; id=Grid1 style=&quot;LEFT: 0px; TOP: 0px&quot;>
<PARAM NAME=&quot;_ExtentX&quot; VALUE=&quot;8043&quot;>
<PARAM NAME=&quot;_ExtentY&quot; VALUE=&quot;3889&quot;>
<PARAM NAME=&quot;DataConnection&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;SourceType&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;Recordset&quot; VALUE=&quot;objrs&quot;>
<PARAM NAME=&quot;CtrlName&quot; VALUE=&quot;Grid1&quot;>
<PARAM NAME=&quot;UseAdvancedOnly&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;AdvAddToStyles&quot; VALUE=&quot;-1&quot;>
<PARAM NAME=&quot;AdvTableTag&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;AdvHeaderRowTag&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;AdvHeaderCellTag&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;AdvDetailRowTag&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;AdvDetailCellTag&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;ScriptLanguage&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;ScriptingPlatform&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;EnableRowNav&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;HiliteColor&quot; VALUE=&quot;&quot;>
<PARAM NAME=&quot;RecNavBarHasNextButton&quot; VALUE=&quot;-1&quot;>
<PARAM NAME=&quot;RecNavBarHasPrevButton&quot; VALUE=&quot;-1&quot;>
<PARAM NAME=&quot;RecNavBarNextText&quot; VALUE=&quot; > &quot;>
<PARAM NAME=&quot;RecNavBarPrevText&quot; VALUE=&quot; < &quot;>
<PARAM NAME=&quot;ColumnsNames&quot; VALUE='&quot;=objrs(&quot;&quot;Room&quot;&quot;)&quot;,&quot;=objrs(&quot;&quot;DateR&quot;&quot;)&quot;'>
<PARAM NAME=&quot;columnIndex&quot; VALUE=&quot;0,1&quot;>
<PARAM NAME=&quot;displayWidth&quot; VALUE=&quot;68,68&quot;>
<PARAM NAME=&quot;Coltype&quot; VALUE=&quot;1,1&quot;>
<PARAM NAME=&quot;formated&quot; VALUE=&quot;0,0&quot;>
<PARAM NAME=&quot;DisplayName&quot; VALUE='&quot;Room&quot;,&quot;Date&quot;'>
<PARAM NAME=&quot;DetailAlignment&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;HeaderAlignment&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;DetailBackColor&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;HeaderBackColor&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;HeaderFont&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;HeaderFontColor&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;HeaderFontSize&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;HeaderFontStyle&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;DetailFont&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;DetailFontColor&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;DetailFontSize&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;DetailFontStyle&quot; VALUE=&quot;,&quot;>
<PARAM NAME=&quot;ColumnCount&quot; VALUE=&quot;2&quot;>
<PARAM NAME=&quot;CurStyle&quot; VALUE=&quot;Basic Navy&quot;>
<PARAM NAME=&quot;TitleFont&quot; VALUE=&quot;Arial&quot;>
<PARAM NAME=&quot;titleFontSize&quot; VALUE=&quot;4&quot;>
<PARAM NAME=&quot;TitleFontColor&quot; VALUE=&quot;16777215&quot;>
<PARAM NAME=&quot;TitleBackColor&quot; VALUE=&quot;13416&quot;>
<PARAM NAME=&quot;TitleFontStyle&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;TitleAlignment&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;RowFont&quot; VALUE=&quot;Arial&quot;>
<PARAM NAME=&quot;RowFontColor&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;RowFontStyle&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;RowFontSize&quot; VALUE=&quot;2&quot;>
<PARAM NAME=&quot;RowBackColor&quot; VALUE=&quot;16777215&quot;>
<PARAM NAME=&quot;RowAlignment&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;HighlightColor3D&quot; VALUE=&quot;268435455&quot;>
<PARAM NAME=&quot;ShadowColor3D&quot; VALUE=&quot;268435455&quot;>
<PARAM NAME=&quot;PageSize&quot; VALUE=&quot;20&quot;>
<PARAM NAME=&quot;MoveFirstCaption&quot; VALUE=&quot; |< &quot;>
<PARAM NAME=&quot;MoveLastCaption&quot; VALUE=&quot; >| &quot;>
<PARAM NAME=&quot;MovePrevCaption&quot; VALUE=&quot; << &quot;>
<PARAM NAME=&quot;MoveNextCaption&quot; VALUE=&quot; >> &quot;>
<PARAM NAME=&quot;BorderSize&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;BorderColor&quot; VALUE=&quot;13421772&quot;>
<PARAM NAME=&quot;GridBackColor&quot; VALUE=&quot;8421504&quot;>
<PARAM NAME=&quot;AltRowBckgnd&quot; VALUE=&quot;12632256&quot;>
<PARAM NAME=&quot;CellSpacing&quot; VALUE=&quot;0&quot;>
<PARAM NAME=&quot;WidthSelectionMode&quot; VALUE=&quot;1&quot;>
<PARAM NAME=&quot;GridWidth&quot; VALUE=&quot;304&quot;>
<PARAM NAME=&quot;EnablePaging&quot; VALUE=&quot;-1&quot;>
<PARAM NAME=&quot;ShowStatus&quot; VALUE=&quot;-1&quot;>
<PARAM NAME=&quot;StyleValue&quot; VALUE=&quot;453613&quot;>
<PARAM NAME=&quot;LocalPath&quot; VALUE=&quot;&quot;></OBJECT>
-->
<!--#INCLUDE FILE=&quot;_ScriptLibrary/Button.ASP&quot;-->
<!--#INCLUDE FILE=&quot;_ScriptLibrary/RSNavBar.ASP&quot;-->
<!--#INCLUDE FILE=&quot;_ScriptLibrary/DataGrid.ASP&quot;-->
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function _initGrid1()
{
Grid1.pageSize = 20;
Grid1.setDataSource(objrs);
Grid1.tableAttributes = ' cellpadding=2 cellspacing=0 bordercolor=#cccccc bgcolor=Gray border=1 cols=2 rules=ALL WIDTH=304';
Grid1.headerAttributes = ' bgcolor=#003468 align=Left';
Grid1.headerWidth[0] = ' WIDTH=68';
Grid1.headerWidth[1] = ' WIDTH=68';
Grid1.headerFormat = '<Font face=&quot;Arial&quot; size=4 color=White> <b>';
Grid1.colHeader[0] = '\'Room\'';
Grid1.colHeader[1] = '\'Date\'';
Grid1.rowAttributes[0] = ' bgcolor = White align=Left bordercolor=#cccccc';
Grid1.rowAttributes[1] = ' bgcolor = Silver align=Left bordercolor=#cccccc';
Grid1.rowFormat[0] = ' <Font face=&quot;Arial&quot; size=2 color=Black >';
Grid1.colAttributes[0] = ' WIDTH=68';
Grid1.colFormat[0] = '<Font Size=2 Face=&quot;Arial&quot; Color=Black >';
Grid1.colData[0] = 'objrs(&quot;Room&quot;)';
Grid1.colAttributes[1] = ' WIDTH=68';
Grid1.colFormat[1] = '<Font Size=2 Face=&quot;Arial&quot; Color=Black >';
Grid1.colData[1] = 'objrs(&quot;DateR&quot;)';
Grid1.navbarAlignment = 'Right';
var objPageNavbar = Grid1.showPageNavbar(170,1);
objPageNavbar.getButton(0).value = ' |< ';
objPageNavbar.getButton(1).value = ' << ';
objPageNavbar.getButton(2).value = ' >> ';
objPageNavbar.getButton(3).value = ' >| ';
Grid1.hasPageNumber = true;
}
function _Grid1_ctor()
{
CreateDataGrid('Grid1',_initGrid1);
}
</SCRIPT>

<% Grid1.display %>


<!--METADATA TYPE=&quot;DesignerControl&quot; endspan-->

</BODY>
<% ' VI 6.0 Scripting Object Model Enabled %>
<% EndPageProcessing() %>
</FORM>
</HTML>

Again, any assistance would be great.
Thank you

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top