soontobefour
MIS
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="_ScriptLibrary/pm.asp"-->
<% if StartPageProcessing() Then Response.End() %>
<FORM name=thisForm METHOD=post>
<% dim objrs
dim objrs1
set objconn = server.createobject("adodb.connection"
objconn.Open session("connectionstring"
sub search
'Sql statement that finds the rooms that are reserved
' in the reservation table for a particular Requestor
sql = "SELECT reservation.room, reservation.dateR, "&_
"reservation.start_time, reservation.end_time "&_
"FROM Reservation "&_
"WHERE reservation.requestor = '" &Request.QueryString("requestor"&"'"
set objrs = server.createobject("adodb.recordset"
objrs.open sql, objconn, 0 ,1 ,1
do until objrs.EOF
%> <tr><td><td><td><td><td><td> <%=objrs("Room"%>
<td><td><td><td><td><td><td><td><td><td><td> <%=objrs("DateR"%>
<td><td><td><td><td><td><td><td><td><td><td><td><td> <%=mid(objrs("Start_Time",10,7)%>
<td><td><td><td><td><td><td><td><td><td><td><td><td> <%=mid(objrs("End_Time",10,7)%>
<%objrs.MoveNext
loop
objrs.Close
end sub
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY bgColor=skyblue>
<table border=1 align=center style="HEIGHT: 43px; WIDTH: 600px">
<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="DesignerControl" startspan
<OBJECT classid="clsid:277FC3F2-E90F-11D0-B767-0000F81E081D" id=Grid1 style="LEFT: 0px; TOP: 0px">
<PARAM NAME="_ExtentX" VALUE="8043">
<PARAM NAME="_ExtentY" VALUE="3889">
<PARAM NAME="DataConnection" VALUE="">
<PARAM NAME="SourceType" VALUE="">
<PARAM NAME="Recordset" VALUE="objrs">
<PARAM NAME="CtrlName" VALUE="Grid1">
<PARAM NAME="UseAdvancedOnly" VALUE="0">
<PARAM NAME="AdvAddToStyles" VALUE="-1">
<PARAM NAME="AdvTableTag" VALUE="">
<PARAM NAME="AdvHeaderRowTag" VALUE="">
<PARAM NAME="AdvHeaderCellTag" VALUE="">
<PARAM NAME="AdvDetailRowTag" VALUE="">
<PARAM NAME="AdvDetailCellTag" VALUE="">
<PARAM NAME="ScriptLanguage" VALUE="1">
<PARAM NAME="ScriptingPlatform" VALUE="0">
<PARAM NAME="EnableRowNav" VALUE="0">
<PARAM NAME="HiliteColor" VALUE="">
<PARAM NAME="RecNavBarHasNextButton" VALUE="-1">
<PARAM NAME="RecNavBarHasPrevButton" VALUE="-1">
<PARAM NAME="RecNavBarNextText" VALUE=" > ">
<PARAM NAME="RecNavBarPrevText" VALUE=" < ">
<PARAM NAME="ColumnsNames" VALUE='"=objrs(""Room""","=objrs(""DateR"""'>
<PARAM NAME="columnIndex" VALUE="0,1">
<PARAM NAME="displayWidth" VALUE="68,68">
<PARAM NAME="Coltype" VALUE="1,1">
<PARAM NAME="formated" VALUE="0,0">
<PARAM NAME="DisplayName" VALUE='"Room","Date"'>
<PARAM NAME="DetailAlignment" VALUE=",">
<PARAM NAME="HeaderAlignment" VALUE=",">
<PARAM NAME="DetailBackColor" VALUE=",">
<PARAM NAME="HeaderBackColor" VALUE=",">
<PARAM NAME="HeaderFont" VALUE=",">
<PARAM NAME="HeaderFontColor" VALUE=",">
<PARAM NAME="HeaderFontSize" VALUE=",">
<PARAM NAME="HeaderFontStyle" VALUE=",">
<PARAM NAME="DetailFont" VALUE=",">
<PARAM NAME="DetailFontColor" VALUE=",">
<PARAM NAME="DetailFontSize" VALUE=",">
<PARAM NAME="DetailFontStyle" VALUE=",">
<PARAM NAME="ColumnCount" VALUE="2">
<PARAM NAME="CurStyle" VALUE="Basic Navy">
<PARAM NAME="TitleFont" VALUE="Arial">
<PARAM NAME="titleFontSize" VALUE="4">
<PARAM NAME="TitleFontColor" VALUE="16777215">
<PARAM NAME="TitleBackColor" VALUE="13416">
<PARAM NAME="TitleFontStyle" VALUE="1">
<PARAM NAME="TitleAlignment" VALUE="0">
<PARAM NAME="RowFont" VALUE="Arial">
<PARAM NAME="RowFontColor" VALUE="0">
<PARAM NAME="RowFontStyle" VALUE="0">
<PARAM NAME="RowFontSize" VALUE="2">
<PARAM NAME="RowBackColor" VALUE="16777215">
<PARAM NAME="RowAlignment" VALUE="0">
<PARAM NAME="HighlightColor3D" VALUE="268435455">
<PARAM NAME="ShadowColor3D" VALUE="268435455">
<PARAM NAME="PageSize" VALUE="20">
<PARAM NAME="MoveFirstCaption" VALUE=" |< ">
<PARAM NAME="MoveLastCaption" VALUE=" >| ">
<PARAM NAME="MovePrevCaption" VALUE=" << ">
<PARAM NAME="MoveNextCaption" VALUE=" >> ">
<PARAM NAME="BorderSize" VALUE="1">
<PARAM NAME="BorderColor" VALUE="13421772">
<PARAM NAME="GridBackColor" VALUE="8421504">
<PARAM NAME="AltRowBckgnd" VALUE="12632256">
<PARAM NAME="CellSpacing" VALUE="0">
<PARAM NAME="WidthSelectionMode" VALUE="1">
<PARAM NAME="GridWidth" VALUE="304">
<PARAM NAME="EnablePaging" VALUE="-1">
<PARAM NAME="ShowStatus" VALUE="-1">
<PARAM NAME="StyleValue" VALUE="453613">
<PARAM NAME="LocalPath" VALUE=""></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/Button.ASP"-->
<!--#INCLUDE FILE="_ScriptLibrary/RSNavBar.ASP"-->
<!--#INCLUDE FILE="_ScriptLibrary/DataGrid.ASP"-->
<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="Arial" 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="Arial" size=2 color=Black >';
Grid1.colAttributes[0] = ' WIDTH=68';
Grid1.colFormat[0] = '<Font Size=2 Face="Arial" Color=Black >';
Grid1.colData[0] = 'objrs("Room"';
Grid1.colAttributes[1] = ' WIDTH=68';
Grid1.colFormat[1] = '<Font Size=2 Face="Arial" Color=Black >';
Grid1.colData[1] = 'objrs("DateR"';
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="DesignerControl" endspan-->
</BODY>
<% ' VI 6.0 Scripting Object Model Enabled %>
<% EndPageProcessing() %>
</FORM>
</HTML>
Again, any assistance would be great.
Thank you
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="_ScriptLibrary/pm.asp"-->
<% if StartPageProcessing() Then Response.End() %>
<FORM name=thisForm METHOD=post>
<% dim objrs
dim objrs1
set objconn = server.createobject("adodb.connection"
objconn.Open session("connectionstring"
sub search
'Sql statement that finds the rooms that are reserved
' in the reservation table for a particular Requestor
sql = "SELECT reservation.room, reservation.dateR, "&_
"reservation.start_time, reservation.end_time "&_
"FROM Reservation "&_
"WHERE reservation.requestor = '" &Request.QueryString("requestor"&"'"
set objrs = server.createobject("adodb.recordset"
objrs.open sql, objconn, 0 ,1 ,1
do until objrs.EOF
%> <tr><td><td><td><td><td><td> <%=objrs("Room"%>
<td><td><td><td><td><td><td><td><td><td><td> <%=objrs("DateR"%>
<td><td><td><td><td><td><td><td><td><td><td><td><td> <%=mid(objrs("Start_Time",10,7)%>
<td><td><td><td><td><td><td><td><td><td><td><td><td> <%=mid(objrs("End_Time",10,7)%>
<%objrs.MoveNext
loop
objrs.Close
end sub
%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY bgColor=skyblue>
<table border=1 align=center style="HEIGHT: 43px; WIDTH: 600px">
<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="DesignerControl" startspan
<OBJECT classid="clsid:277FC3F2-E90F-11D0-B767-0000F81E081D" id=Grid1 style="LEFT: 0px; TOP: 0px">
<PARAM NAME="_ExtentX" VALUE="8043">
<PARAM NAME="_ExtentY" VALUE="3889">
<PARAM NAME="DataConnection" VALUE="">
<PARAM NAME="SourceType" VALUE="">
<PARAM NAME="Recordset" VALUE="objrs">
<PARAM NAME="CtrlName" VALUE="Grid1">
<PARAM NAME="UseAdvancedOnly" VALUE="0">
<PARAM NAME="AdvAddToStyles" VALUE="-1">
<PARAM NAME="AdvTableTag" VALUE="">
<PARAM NAME="AdvHeaderRowTag" VALUE="">
<PARAM NAME="AdvHeaderCellTag" VALUE="">
<PARAM NAME="AdvDetailRowTag" VALUE="">
<PARAM NAME="AdvDetailCellTag" VALUE="">
<PARAM NAME="ScriptLanguage" VALUE="1">
<PARAM NAME="ScriptingPlatform" VALUE="0">
<PARAM NAME="EnableRowNav" VALUE="0">
<PARAM NAME="HiliteColor" VALUE="">
<PARAM NAME="RecNavBarHasNextButton" VALUE="-1">
<PARAM NAME="RecNavBarHasPrevButton" VALUE="-1">
<PARAM NAME="RecNavBarNextText" VALUE=" > ">
<PARAM NAME="RecNavBarPrevText" VALUE=" < ">
<PARAM NAME="ColumnsNames" VALUE='"=objrs(""Room""","=objrs(""DateR"""'>
<PARAM NAME="columnIndex" VALUE="0,1">
<PARAM NAME="displayWidth" VALUE="68,68">
<PARAM NAME="Coltype" VALUE="1,1">
<PARAM NAME="formated" VALUE="0,0">
<PARAM NAME="DisplayName" VALUE='"Room","Date"'>
<PARAM NAME="DetailAlignment" VALUE=",">
<PARAM NAME="HeaderAlignment" VALUE=",">
<PARAM NAME="DetailBackColor" VALUE=",">
<PARAM NAME="HeaderBackColor" VALUE=",">
<PARAM NAME="HeaderFont" VALUE=",">
<PARAM NAME="HeaderFontColor" VALUE=",">
<PARAM NAME="HeaderFontSize" VALUE=",">
<PARAM NAME="HeaderFontStyle" VALUE=",">
<PARAM NAME="DetailFont" VALUE=",">
<PARAM NAME="DetailFontColor" VALUE=",">
<PARAM NAME="DetailFontSize" VALUE=",">
<PARAM NAME="DetailFontStyle" VALUE=",">
<PARAM NAME="ColumnCount" VALUE="2">
<PARAM NAME="CurStyle" VALUE="Basic Navy">
<PARAM NAME="TitleFont" VALUE="Arial">
<PARAM NAME="titleFontSize" VALUE="4">
<PARAM NAME="TitleFontColor" VALUE="16777215">
<PARAM NAME="TitleBackColor" VALUE="13416">
<PARAM NAME="TitleFontStyle" VALUE="1">
<PARAM NAME="TitleAlignment" VALUE="0">
<PARAM NAME="RowFont" VALUE="Arial">
<PARAM NAME="RowFontColor" VALUE="0">
<PARAM NAME="RowFontStyle" VALUE="0">
<PARAM NAME="RowFontSize" VALUE="2">
<PARAM NAME="RowBackColor" VALUE="16777215">
<PARAM NAME="RowAlignment" VALUE="0">
<PARAM NAME="HighlightColor3D" VALUE="268435455">
<PARAM NAME="ShadowColor3D" VALUE="268435455">
<PARAM NAME="PageSize" VALUE="20">
<PARAM NAME="MoveFirstCaption" VALUE=" |< ">
<PARAM NAME="MoveLastCaption" VALUE=" >| ">
<PARAM NAME="MovePrevCaption" VALUE=" << ">
<PARAM NAME="MoveNextCaption" VALUE=" >> ">
<PARAM NAME="BorderSize" VALUE="1">
<PARAM NAME="BorderColor" VALUE="13421772">
<PARAM NAME="GridBackColor" VALUE="8421504">
<PARAM NAME="AltRowBckgnd" VALUE="12632256">
<PARAM NAME="CellSpacing" VALUE="0">
<PARAM NAME="WidthSelectionMode" VALUE="1">
<PARAM NAME="GridWidth" VALUE="304">
<PARAM NAME="EnablePaging" VALUE="-1">
<PARAM NAME="ShowStatus" VALUE="-1">
<PARAM NAME="StyleValue" VALUE="453613">
<PARAM NAME="LocalPath" VALUE=""></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/Button.ASP"-->
<!--#INCLUDE FILE="_ScriptLibrary/RSNavBar.ASP"-->
<!--#INCLUDE FILE="_ScriptLibrary/DataGrid.ASP"-->
<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="Arial" 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="Arial" size=2 color=Black >';
Grid1.colAttributes[0] = ' WIDTH=68';
Grid1.colFormat[0] = '<Font Size=2 Face="Arial" Color=Black >';
Grid1.colData[0] = 'objrs("Room"';
Grid1.colAttributes[1] = ' WIDTH=68';
Grid1.colFormat[1] = '<Font Size=2 Face="Arial" Color=Black >';
Grid1.colData[1] = 'objrs("DateR"';
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="DesignerControl" endspan-->
</BODY>
<% ' VI 6.0 Scripting Object Model Enabled %>
<% EndPageProcessing() %>
</FORM>
</HTML>
Again, any assistance would be great.
Thank you