• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

I keep getting the error "ADODB.Recordset error '800a0bb9' " on my ASP page

When my aps page loads I get the error "ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/energysysvc/testing/Report_by_type.asp, line 67
" Can someone help me out with this. the code is below.
<%@ Language=VBScript %>

<!--#include file="../includes/adovbs.inc"-->


<%
	Session("business") = Request("business")
		Session("Category") = Request("Category")
		Session("Year") = Request("Year")
		


dim Rs
Dim strSQL

		
		'Response.Write "servername = " & servername
	
	UID = Request.ServerVariables("LOGON_USER")
	Uname = ucase(right(UID,7))	
	response.write Uname %>
	<br>
	<%	

		
		
		vXlsFile = "\virtual\documents\Energysysvc\EHS4KeyList.xls"
		

		vXlsFile = Server.Mappath(vXlsFile)

		ExcelConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
		"Data Source=" & chr(34) & vXlsFile & chr(34) & ";" & _
		"Extended Properties=" & chr(34) & "Excel 8.0;"& chr(34)

		
		
		Set Conn = Server.CreateObject("ADODB.Connection")
		Conn.Open ExcelConnString
		
'set RS = server.createobject("adodb.recordset")
				
	
strSQL = "SELECT * FROM tbl4key "
If Request.Form("Year") <> "" OR Request.Form("Business") <> "" Then
     strSQL = strSQL & "WHERE"
End If
If Request.Form("Year") <> "" Then
      strSQL = strSQL & " year = '" & Request.Form("Year") & "'"
      If Request.Form("Business") <> "" Then
            strSQL = strSQL & " and"
      End If
End If
If Request.Form("Business") <> "" Then
      strSQL = strSQL & " Business = '" & Request.Form("Business") & "'"
      If Request.Form("category") <> "" Then
            strSQL = strSQL & " and"
	End If
End If
If Request.Form("category") <> "" Then
      strSQL = strSQL & " Category = '" & Request.Form("category") & "'"
End If
strSQL = strSQL & " ORDER BY 'Year';"
response.write strSQL
'Rs.open strSQL,Conn,1,3
set RS = server.createobject("adodb.recordset")
RS.open sql,Conn,adOpenForwardOnly,adLockReadOnly
%>

<html>

<head>
<meta name="HTML_Expiration_Date" content="">
<meta name="HTML_Reason_Document_Frozen" content="">
<meta name="HTML_Retention_Period_Trigger" content="General Business Record">
<meta name="HTML_Retention_Period_Start_Date" content="">
<meta name="HTML_Retention_Period" content="">
<meta name="HTML_Proprietary_Classification" content="RESTRICTED - For internal use only">
<meta name="HTML_Content_Steward" content="">
<meta name="Author" content="Ferket M u762818">
<link REL="stylesheet" HREF="common/dow/includes/default.css" TYPE="text/css">
<link REL="stylesheet" HREF="common/dow/includes/hdr_n_nav.css" TYPE="text/css">
<title>H&amp;E Incidents by Type</title>
		<meta name="Description" content="Incidents by Type">
				<meta name="Keywords" content="HC&E Incidents by Type">
		</head>

<body onload="SetMenu()">

<table width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td name="HeaderCell" id="HeaderCell"><a name="Top"></a><!--webbot bot="HTMLMarkup" ALT="&lt;h4&gt;The new  Header is in place ...&lt;/h4&gt;" TAG="XBOT" startspan -->
<IFRAME scrolling="no" width="100%" height="94" frameborder="0" marginheight="0" src="common/dow/dowheader.htm"></IFRAME><!--webbot bot="HTMLMarkup" endspan -->
</td>
  </tr>
  <tr>
    <td><div align="left"><table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr>
        <td width="81%">
        <!--webbot bot="Include" U-include="../includes/site_header.htm" TAG="BODY" --></td>
        <td name="RightMarginCell" id="RightMarginCell" rowspan="2"><img height="1" hspace="60" src="common/images/rightspacer.gif" width="78"><p><!--webbot bot="PurpleText" PREVIEW="do not modify." --></td>
      </tr>
      <tr>
        <td><div align="left"><table name="ContentTable" id="ContentTable" border="0" cellpadding="0" cellspacing="0" width="100%">
          <tr>
            <td name="MenuCell" id="MenuCell" valign="top" bgcolor="#dddddd">
            <!--webbot bot="Include" U-include="../includes/menu.htm" TAG="BODY" --></td>
            <td class="Content" name="ContentCell" id="ContentCell" valign="top" width="80%"><h1>
            H&E Incidents of Type <% =category %></h1>												
            
            <STRONG>
            <FONT size=5><EM><FORM id=myFORM method="post">
		
            <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
               				<tr>
								<% if RS.eof then %>
								<tr><td width="100%" align="center">
                                  <pre><span class="SubTitleLarge">There are no Incidents of the Type <% = category %> </span></pre>
                                  </td>
									</table>
									</FORM>
          							</tr>
          							<tr>
            						<td name="FooterCell" id="FooterCell" valign="top" bgcolor="#dddddd"></td>
            						<td name="Footer" id="Footer">
            						<!--webbot bot="Include" U-include="../includes/footer.htm" TAG="BODY" --></td>
          							</tr>
        							</table>
        							</div></td>
      								</tr>
      								<tr>
        							<td name="SpacerCell" id="SpacerCell"><img height="1" src="common/images/topspacer.gif" width="640"></td>
      								</tr>
    								</table>
    								</div></td>
  									</tr>
									</table>

									<%
									response.end
								  Else %>
								  <table border="1" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
               						<tr>
								  	<td width="5%" align="center"><b>Date of Incident</b></td>
									<td width="10%" align="center"><b>Business</b></td>
									<td width="65%" align="center"><b>Title</b></td>
									<td width="10%" align="center"><b>Category</b></td>
									<td width="3%">&nbsp;</td>

									<% do while not RS.eof %>
									<tr>
									<td width="5%" align="center"><% = RS("Year") %>&nbsp;
									<td width="10%" align="center"><% = RS("Business") %>&nbsp;
									<td width="65%"><textarea rows="4" cols="65"><% = RS("Title") %></textarea>&nbsp;
									<td width="10%" align="center"><% = RS("Category") %>&nbsp;
									<td width="3%" align="center">
									<a href="myincidents_view.asp?webref=<% = RS("WebRef") %>">View Details</a>&nbsp;
									<% RS.movenext
									loop 
								  End if %>
							</tr>
						<p>&nbsp;</td>
	   </table>
		</FORM>
          </tr>
          <tr>
            <td name="FooterCell" id="FooterCell" valign="top" bgcolor="#dddddd"></td>
            <td name="Footer" id="Footer">
            <!--webbot bot="Include" U-include="includes/footer_rh.htm" TAG="BODY" --></td></tr></table></div></td></tr><tr><td name="SpacerCell" id="SpacerCell"><img height="1" src="http:///common/images/topspacer.gif" width="640"></td>
      </tr>
    </table>
    </div></td>
  </tr>
</table>
</body>
</html>

Open in new window

0
jlcannon
Asked:
jlcannon
1 Solution
 
Ivo StoykovCommented:
Hi
It seems that
RS.open sql,Conn,adOpenForwardOnly,adLockReadOnly
should be
RS.open strSQL,Conn,adOpenForwardOnly,adLockReadOnly
Additionally I do not see checkes what happens after asignments in the code - I mean that some might fail...
HTH
Ivo Stoykov


0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now