patrussell
Technical User
I have a recordset that retrieves data using a parameterized DE command. The parameter is set in a textbox where the user enters a date then clicks a button to retrieve the data.
I can get this page to work the first time I load it but after that I get an ADODB error and have to reload (not refresh) the page to get it to work. I would like to have everything updated when a new date is entered and the button pressed again. I'm very new at this and am learning as I go so I'm sure this is something obvious I am missing.
I have posted the error I get and my code below. Thanks for any help you can give.
Here is the error message:
Technical Information (for support personnel)
Error Type:
ADODB.Parameter (0x800A0D5D)
Application uses a value of the wrong type for the current operation.
/_ScriptLibrary/Recordset.ASP, line 456
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Avant Browser [avantbrowser.com])
Page:
POST 483 bytes to /ba_muffledata.asp
POST Data:
Textbox2=6%2F30%2F03&_method=%2Fba_muffledata.asp%3F_method%3D_EM__onclientevent%26pcount%3D2%26p0%3DButton1%26p1%3Donclick&_Textbox2_state=_bVisible%3Dtrue%26_nColumnCount%3D20%26_nMaxLength%3D20&_Bu . . .
Here is my asp page code:
I can get this page to work the first time I load it but after that I get an ADODB error and have to reload (not refresh) the page to get it to work. I would like to have everything updated when a new date is entered and the button pressed again. I'm very new at this and am learning as I go so I'm sure this is something obvious I am missing.
I have posted the error I get and my code below. Thanks for any help you can give.
Here is the error message:
Technical Information (for support personnel)
Error Type:
ADODB.Parameter (0x800A0D5D)
Application uses a value of the wrong type for the current operation.
/_ScriptLibrary/Recordset.ASP, line 456
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Avant Browser [avantbrowser.com])
Page:
POST 483 bytes to /ba_muffledata.asp
POST Data:
Textbox2=6%2F30%2F03&_method=%2Fba_muffledata.asp%3F_method%3D_EM__onclientevent%26pcount%3D2%26p0%3DButton1%26p1%3Donclick&_Textbox2_state=_bVisible%3Dtrue%26_nColumnCount%3D20%26_nMaxLength%3D20&_Bu . . .
Here is my asp page code:
Code:
<%@ 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>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT ID=serverEventHandlersVBS LANGUAGE=vbscript RUNAT=Server>
Sub Button1_onclick()
startdate = cdate(Textbox2.value)
'Textbox2.value = "'" & startdate & "'"
Recordset1.close()
Recordset1.setParameter 0, startdate
Recordset1.open()
End Sub
</SCRIPT>
</HEAD>
<BODY>
<br>
Start Date:
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT id=Textbox2 style="LEFT: 0px; TOP: 0px" classid="clsid:B5F0E469-DC5F-11D0-9846-0000F8027CA0">
<PARAM NAME="_ExtentX" VALUE="3175">
<PARAM NAME="_ExtentY" VALUE="503">
<PARAM NAME="id" VALUE="Textbox2">
<PARAM NAME="ControlType" VALUE="0">
<PARAM NAME="Lines" VALUE="3">
<PARAM NAME="DataSource" VALUE="">
<PARAM NAME="DataField" VALUE="">
<PARAM NAME="Enabled" VALUE="-1">
<PARAM NAME="Visible" VALUE="-1">
<PARAM NAME="MaxChars" VALUE="20">
<PARAM NAME="DisplayWidth" VALUE="20">
<PARAM NAME="Platform" VALUE="256">
<PARAM NAME="LocalPath" VALUE=""></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/TextBox.ASP"-->
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function _initTextbox2()
{
Textbox2.setStyle(TXT_TEXTBOX);
Textbox2.setMaxLength(20);
Textbox2.setColumnCount(20);
}
function _Textbox2_ctor()
{
CreateTextbox('Textbox2', _initTextbox2, null);
}
</script>
<% Textbox2.display %>
<!--METADATA TYPE="DesignerControl" endspan-->
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT id=Button1 style="LEFT: 10px; WIDTH: 112px; TOP: 53px; HEIGHT: 27px" height=27
width=112 classid="clsid:B6FC3A14-F837-11D0-9CC8-006008058731">
<PARAM NAME="_ExtentX" VALUE="2963">
<PARAM NAME="_ExtentY" VALUE="714">
<PARAM NAME="id" VALUE="Button1">
<PARAM NAME="Caption" VALUE="Retrieve Data">
<PARAM NAME="Image" VALUE="">
<PARAM NAME="AltText" VALUE="">
<PARAM NAME="Visible" VALUE="-1">
<PARAM NAME="Platform" VALUE="256">
<PARAM NAME="LocalPath" VALUE=""></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/Button.ASP"-->
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function _initButton1()
{
Button1.value = 'Retrieve Data';
Button1.setStyle(0);
}
function _Button1_ctor()
{
CreateButton('Button1', _initButton1, null);
}
</script>
<% Button1.display %>
<!--METADATA TYPE="DesignerControl" endspan-->
<br>
<br>
<P> </P>
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT id=Recordset1 style="LEFT: 0px; TOP: 0px" classid="clsid:9CF5D7C2-EC10-11D0-9862-0000F8027CA0">
<PARAM NAME="ExtentX" VALUE="12197">
<PARAM NAME="ExtentY" VALUE="2090">
<PARAM NAME="State" VALUE="(TCConn=\qBright\q,TCDBObject=\qDE\sCommands\q,TCDBObjectName=\qBA_MuffleData\q,TCControlID_Unmatched=\qRecordset1\q,TCPPConn=\qBright\q,RCDBObject=\qRCDBObject\q,TCPPDBObject=\qDE\sCommands\q,TCPPDBObjectName=\qBA_MuffleData\q,TCCursorType=\q3\s-\sStatic\q,TCCursorLocation=\q3\s-\sUse\sclient-side\scursors\q,TCLockType=\q3\s-\sOptimistic\q,TCCacheSize_Unmatched=\q100\q,TCCommTimeout_Unmatched=\q30\q,CCPrepared=0,CCAllRecords=1,TCNRecords_Unmatched=\q10\q,TCODBCSyntax_Unmatched=\q\q,TCHTargetPlatform=\q\q,TCHTargetBrowser_Unmatched=\qServer\s(ASP)\q,TCTargetPlatform=\qInherit\sfrom\spage\q,RCCache=\qRCBookPage\q,CCOpen=0,GCParameters=(Rows=1,Row1=(CType_Unmatched=\qIn\q,CParName_Unmatched=\qParam1\q,CDataType_Unmatched=\qDBTmieStamp\q,CSize_Unmatched=\q16\q,CReq=1,CValue_Unmatched=\q\q)))"></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/Recordset.ASP"-->
<SCRIPT LANGUAGE="JavaScript" RUNAT="server">
function _setParametersRecordset1()
{
}
function _initRecordset1()
{
Recordset1.advise(RS_ONBEFOREOPEN, _setParametersRecordset1);
thisPage.createDE();
var rsTmp = DE.Recordsets('BA_MuffleData');
Recordset1.setRecordSource(rsTmp);
if (thisPage.getState('pb_Recordset1') != null)
Recordset1.setBookmark(thisPage.getState('pb_Recordset1'));
}
function _Recordset1_ctor()
{
CreateRecordset('Recordset1', _initRecordset1, null);
}
function _Recordset1_dtor()
{
Recordset1._preserveState();
thisPage.setState('pb_Recordset1', Recordset1.getBookmark());
}
</SCRIPT>
<!--METADATA TYPE="DesignerControl" endspan-->
<!--METADATA TYPE="DesignerControl" startspan
<OBJECT id=Grid1 style="LEFT: 0px; TOP: 0px" classid="clsid:277FC3F2-E90F-11D0-B767-0000F81E081D">
<PARAM NAME="_ExtentX" VALUE="8043">
<PARAM NAME="_ExtentY" VALUE="3889">
<PARAM NAME="DataConnection" VALUE="">
<PARAM NAME="SourceType" VALUE="">
<PARAM NAME="Recordset" VALUE="Recordset1">
<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='"DateTime","OP1 Position","OP2 Position","DR1 Position","DR2 Position","Line Speed","Gauge","Width","Zone 1 Temp"'>
<PARAM NAME="columnIndex" VALUE="0,1,2,3,4,5,6,7,8">
<PARAM NAME="displayWidth" VALUE="68,68,68,68,68,68,68,68,68">
<PARAM NAME="Coltype" VALUE="1,1,1,1,1,1,1,1,1">
<PARAM NAME="formated" VALUE="0,0,0,0,0,0,0,0,0">
<PARAM NAME="DisplayName" VALUE='"DateTime","OP1 Position","OP2 Position","DR1 Position","DR2 Position","Line Speed","Gauge","Width","Zone 1 Temp"'>
<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="9">
<PARAM NAME="CurStyle" VALUE="Basic Maroon">
<PARAM NAME="TitleFont" VALUE="Arial Narrow">
<PARAM NAME="titleFontSize" VALUE="3">
<PARAM NAME="TitleFontColor" VALUE="16777215">
<PARAM NAME="TitleBackColor" VALUE="8388608">
<PARAM NAME="TitleFontStyle" VALUE="1">
<PARAM NAME="TitleAlignment" VALUE="0">
<PARAM NAME="RowFont" VALUE="Arial Narrow">
<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="16777215">
<PARAM NAME="GridBackColor" VALUE="8388608">
<PARAM NAME="AltRowBckgnd" VALUE="12632256">
<PARAM NAME="CellSpacing" VALUE="1">
<PARAM NAME="WidthSelectionMode" VALUE="1">
<PARAM NAME="GridWidth" VALUE="304">
<PARAM NAME="EnablePaging" VALUE="0">
<PARAM NAME="ShowStatus" VALUE="-1">
<PARAM NAME="StyleValue" VALUE="437229">
<PARAM NAME="LocalPath" VALUE=""></OBJECT>
-->
<!--#INCLUDE FILE="_ScriptLibrary/RSNavBar.ASP"-->
<!--#INCLUDE FILE="_ScriptLibrary/DataGrid.ASP"-->
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function _initGrid1()
{
Grid1.pageSize = 0;
Grid1.setDataSource(Recordset1);
Grid1.tableAttributes = ' cellpadding=2 cellspacing=1 bordercolor=White bgcolor=Maroon border=1 cols=9 rules=ALL WIDTH=304 nowrap';
Grid1.headerAttributes = ' bgcolor=Maroon align=Left nowrap';
Grid1.headerWidth[0] = ' WIDTH=68';
Grid1.headerWidth[1] = ' WIDTH=68';
Grid1.headerWidth[2] = ' WIDTH=68';
Grid1.headerWidth[3] = ' WIDTH=68';
Grid1.headerWidth[4] = ' WIDTH=68';
Grid1.headerWidth[5] = ' WIDTH=68';
Grid1.headerWidth[6] = ' WIDTH=68';
Grid1.headerWidth[7] = ' WIDTH=68';
Grid1.headerWidth[8] = ' WIDTH=68';
Grid1.headerFormat = '<Font face="Arial Narrow" size=3 color=White> <b>';
Grid1.colHeader[0] = '\'DateTime\'';
Grid1.colHeader[1] = '\'OP1 Position\'';
Grid1.colHeader[2] = '\'OP2 Position\'';
Grid1.colHeader[3] = '\'DR1 Position\'';
Grid1.colHeader[4] = '\'DR2 Position\'';
Grid1.colHeader[5] = '\'Line Speed\'';
Grid1.colHeader[6] = '\'Gauge\'';
Grid1.colHeader[7] = '\'Width\'';
Grid1.colHeader[8] = '\'Zone 1 Temp\'';
Grid1.rowAttributes[0] = ' bgcolor = White align=Left nowrap bordercolor=White';
Grid1.rowAttributes[1] = ' bgcolor = Silver align=Left nowrap bordercolor=White';
Grid1.rowFormat[0] = ' <Font face="Arial Narrow" size=2 color=Black >';
Grid1.colAttributes[0] = ' WIDTH=68';
Grid1.colFormat[0] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[0] = 'Recordset1.fields.getValue(\'DateTime\')';
Grid1.colAttributes[1] = ' WIDTH=68';
Grid1.colFormat[1] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[1] = 'Recordset1.fields.getValue(\'OP1 Position\')';
Grid1.colAttributes[2] = ' WIDTH=68';
Grid1.colFormat[2] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[2] = 'Recordset1.fields.getValue(\'OP2 Position\')';
Grid1.colAttributes[3] = ' WIDTH=68';
Grid1.colFormat[3] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[3] = 'Recordset1.fields.getValue(\'DR1 Position\')';
Grid1.colAttributes[4] = ' WIDTH=68';
Grid1.colFormat[4] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[4] = 'Recordset1.fields.getValue(\'DR2 Position\')';
Grid1.colAttributes[5] = ' WIDTH=68';
Grid1.colFormat[5] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[5] = 'Recordset1.fields.getValue(\'Line Speed\')';
Grid1.colAttributes[6] = ' WIDTH=68';
Grid1.colFormat[6] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[6] = 'Recordset1.fields.getValue(\'Gauge\')';
Grid1.colAttributes[7] = ' WIDTH=68';
Grid1.colFormat[7] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[7] = 'Recordset1.fields.getValue(\'Width\')';
Grid1.colAttributes[8] = ' WIDTH=68';
Grid1.colFormat[8] = '<Font Size=2 Face="Arial Narrow" Color=Black >';
Grid1.colData[8] = 'Recordset1.fields.getValue(\'Zone 1 Temp\')';
}
function _Grid1_ctor()
{
CreateDataGrid('Grid1',_initGrid1);
}
</SCRIPT>
<% Grid1.display %>
<!--METADATA TYPE="DesignerControl" endspan-->
</BODY>
<% ' VI 6.0 Scripting Object Model Enabled %>
<% EndPageProcessing() %>
</FORM>
</HTML>