PDA

View Full Version : ADODB.Recordset (0x800A0BB9)


zami
12-12-2010, 01:35 PM
hi everyone
i want to display data on my web page, on behalf of some selections, from different databases, when i select generate report its give me error msg,
initially 2 tables are showing data, code school gender, (gend-id, gend-Type both text values)and code school lever,(Lev-id, Lev-Type, text property)
please someone help as early as possible. thanks
here are the codes of file
thanks
azmi

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Reform Support Unit - RSU</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//-->
</script>
<link href="rsustyle.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="JavaScript" src="flipmenu.js">

/***********************************************
* Developed
***********************************************/

</script>
<script language="javascript" src="ts_files/scroll.js"></script>
<style type="text/css">
<!--
.style34 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; }
.style35 {
font-size: 12px;
font-weight: bold;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style40 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12; }
.style41 {font-size: 12}
.style42 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</head>
<%

m_item = Request.QueryString("mitem")

RF_Dist = Request.Form("cmbDistrict")
RF_Teh = Request.Form("cmbTaluka")

Set conn =Server.CreateObject("adodb.connection")
Dim strDBPath

strDBPath = Server.MapPath("database/SEMISdatabase.mdb")

dim strConnectionString
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
conn.Open strConnectionString

sqldistrict = "select = districtid,district from district order by districtid"
Set RSDist = conn.Execute(sqldistrict)
if RSDist.eof then
Response.write("No district in database ...")
Response.End
end if
if isNull(RS_Dist) or isEmpty(RF_Dist) or RF_Dist = "" then
if not RSDist.eof then
RF_DIst = RSDIST(0)
end if
end if


sqltehsil = "select tehsilid,tehsil from Tehsil where DistrictID ='"&RF_Dist&"' order by tehsilid"
Set RSteh = conn.Execute(sqltehsil)
if isNull(RS_Teh) or isEmpty(RF_Teh) or RF_Teh = "" then
if not RSTeh.eof then
RF_Teh = RSTeh(0)
end if
end if
%>


<body>
<div align="center"><img src="image/RSU Header.JPG" width="799" height="136" /><br />
<table width="800" border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="100%" colspan="3"><table width="556" border="0" align="right" class="Heading">
<tr>
<td width="54"><div align="center"><a href="RSU-Sindh.html">Home</a></div></td>
<td width="86"><div align="center"><a href="aboutus.html">About Us</a></div></td>
<td width="100"><div align="center"><a href="contactus1.html">Contact Us</a></div></td>
<td width="80"><div align="center">Calendar</div></td>
<td width="111"><div align="center"><a href="departments.html">Departments</a></div></td>
<td width="133">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<br />
<table width="800" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan="3" ><form method="post" name="da" id="da" action="dbReportDisplay.asp" >
<table width="456" border="0" bgcolor="#CCCCCC" align="center">
<tr>
<td colspan="3"><div align="center"><span class="style35">Please select the following options for Generate Reports </span></div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class="style42"><span class="style40">Select Type of Report</span></td>
<td>:</td>
<td><div align="left">
<select name="cmbReportType">
<option value="0" selected="selected">Please Select...</option>
<option value="1">Schools Reports</option>
<option value="2">Enrolment Reports</option>
<option value="3">Teachers Reports</option>
<option value="4">Infra-Structre Reports</option>
<option value="5">Summary Reports</option>
</select>
</div></td>
</tr>
<tr>
<td class="style42"><span class="style40">Select Report</span></td>
<td>:</td>
<td><div align="left">
<select name="cmbReports">
<option value="0" selected="selected">Please Select...</option>
<option value="1">Schools by level and gender</option>
<option value="2">Schools by status level and gender</option>
</select>
</div></td>
</tr>
<tr>
<td class="style42"><span class="style40">Select District </span></td>
<td>:</td>
<td><div align="left">
<select id="cmbDistrict" name="cmbDistrict" onchange="da.action='semismain.asp?mitem=1';da.submit()">
<%If Not RSDist.EOF then
RSDist.MoveFirst
do while not RSDist.EOF
If RSDist(0) = RF_Dist then%>
<option selected="selected" value="<%=RSDist(0)%>"><%=RSDist(1)%></option>
<%Else%>
<option value="<%=RSDist(0)%>"><%=RSDist(1)%></option>
<%End if
RSDist.movenext
loop
End if %>
</select>
</div></td>
</tr>
<tr>
<td class="style42"><span class="style40">Select Taluka </span></td>
<td>:</td>
<td><div align="left"><span class="style34">
<select id="cmbTaluka" name="cmbTaluka" onchange="da.action='semismain.asp?mitem=2';da.submit()">
<%
If Not RSTeh.EOF then
RSTeh.MoveFirst
do while not RSTeh.EOF
If RSTeh(0) = RF_Teh then%>
<option selected="selected" value="<%=RSTeh(0)%>"><%=RSTeh(1)%></option>
<%Else%>
<option value="<%=RSTeh(0)%>"><%=RSTeh(1)%></option>
<%End if
RSTeh.movenext
loop
End if%>
</select>
</span></div></td>
</tr>
<tr>
<td width="141"><span class="style41"></span></td>
<td width="3">&nbsp;</td>
<td width="298"><div align="left">
<input type="submit" name="Submit" value="Generate Report" />
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><label></label></td>
</tr>
<tr>
<td colspan="3"><div align="left" class="style42">Please select district for district reports and taluka for taluka reports of district, for provincial reports select only report type and report </div></td>
</tr>
</table>



<label><br />
</label>
<label></label>
<label></label>
</form>


</body>
</html>

Old Pedant
12-13-2010, 01:15 AM
Well you have an error here:

sqldistrict = "select = districtid,district from district order by districtid"

That = is an error.

Beyond that, I'm not sure what you are asking for.

zami
12-13-2010, 05:52 AM
yes i already corrected that error, and after that while i m trying to test, its saying error.
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/rsunew/dbReportDisplay.asp, line 61

here is the code of dbreportDisplay.asp

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
-->
</style>
</head>

<body>
<p>
<div align="center">
<img src="image/RSU Header.JPG" alt=" " width="799" height="136" />
<table width="800" border="0" cellspacing="0" cellpadding="0">

<tr>
<td width="100%" colspan="3"><table width="556" border="0" align="center" class="Heading">
<tr>
<td width="54"><div align="center" class="style2"><a href="RSU-Sindh.html">Home</a></div></td>
<td width="86"><div align="center" class="style2"><a href="aboutus.html">About Us</a></div></td>
<td width="100"><div align="center" class="style2"><a href="contactus1.html">Contact Us</a></div></td>
<td width="80"><div align="center" class="style2">Calendar</div></td>
<td width="111"><div align="center" class="style2"><a href="departments.html">Departments</a></div></td>
<td width="133"><div align="center"></div></td>
</tr>
</table></td>
</tr>
</table>
<p>
<%
District = Request.Form("cmbDistrict")
Tehsil = Request.Form("cmbTaluka")

Dim RS ' ADO recordset
Dim strDBPath ' path to our Access database (*.mdb) file

strDBPath = Server.MapPath("database/SEMISdatabase.mdb")
dim strConnectionString
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"
%>


<%

if request.Form("cmbReportType")= 1 and request.Form("cmbReports")= 1 then
SQL = "TRANSFORM Count(univ2009.Schoolid) AS CountOfSchoolid SELECT [Code School Level].[Lev-id], [Code School Level].[lev-Type] FROM (univ2009 INNER JOIN [Code School Level] ON univ2009.LevelID = [Code School Level].[Lev-id]) INNER JOIN [Code School Gender] ON univ2009.GenderID = [Code School Gender].[Gend-id] GROUP BY [Code School Level].[Lev-id], [Code School Level].[lev-Type] ORDER BY [Code School Level].[Lev-id], [Code School Gender].[Gend-type] PIVOT [Code School Gender].[Gend-type] where district='"&District&"'"
end if


' if request.Form("cmbReportType")= 1 and request.Form("cmbReports")= 2 then ' Schools by status level and gender
'SQL = "TRANSFORM Count(univ2009.SCHOOLID) AS CountOfSCHOOLID SELECT [Code School Level].[Lev-id], [Code School Level].[lev-Type], [Code Status].[Status-id], [Code Status].Status FROM ((univ2009 INNER JOIN [Code School Level] ON univ2009.Levelid=[Code School Level].[Lev-id]) INNER JOIN [Code School Gender] ON univ2009.GenderID=[Code School Gender].[Gend-id]) INNER JOIN [Code Status] ON univ2009.StatusID=[Code Status].[Status-id] GROUP BY [Code School Level].[Lev-id], [Code School Level].[lev-Type], [Code Status].[Status-id], [Code Status].Status ORDER BY [Code School Level].[Lev-id], [Code Status].[Status-id], [Code School Gender].[Gend-type] PIVOT [Code School Gender].[Gend-type]"

'end if
'response.write(request.Form("cmbReportType") & ": ")
'response.write(request.Form("cmbReports"))
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open SQL, strConnectionString

dim fieldName(5), fieldValue(5)
if request.Form("cmbReportType")= 1 and request.Form("cmbReports")= 1 then
'Field Name
FieldName(0) = rs("Lev-Id").name
FieldName(1) = rs("Lev-Type").name
FieldName(2) = rs("Boys").name
FieldName(3) = rs("Girls").name
FieldName(4) = rs("Mixed").name
end if
'if request.Form("cmbReportType")= 1 and request.Form("cmbReports")= 2 then 'Schools by Status level and gender
'Field Name
'FieldName(0) = rs("Lev-Type").name
'FieldName(1) = rs("status").name
'FieldName(2) = rs("Boys").name
'FieldName(3) = rs("Girls").name
'FieldName(4) = rs("Mixed").name

'end if
response.Write("<Table width=500px border=0 bgcolor=#CCCCCC align=center>")

response.Write("<tr><td> " & FieldName(0) & " </td><td> " & FieldName(1) & "</td><td> " & FieldName(2) & "</td><td> " & FieldName(3) & "</td><td> " & FieldName(4) & "</td><td>Total</td></tr>")
dim val1, val2, val3, val4
do while not rs.eof
'Type Schools and Report
'if request.Form("cmbReportType")= 1 and request.Form("cmbReports")= 1 then ' Schools by Gender and level
'FieldValue(0) = rs("Lev-Id")
'FieldValue(1) = rs("Lev-Type")
'FieldValue(2) = rs("Boys")
'FieldValue(3) = rs("Girls")
'FieldValue(4) = rs("Mixed")
'end if
'if request.Form("cmbReportType")= 1 and request.Form("cmbReports")= 2 then 'Schools by Status level and gender
'Field Name
'FieldValue(0) = rs("Lev-Type")
'FieldValue(1) = rs("status")
'FieldValue(2) = rs("Boys")
'FieldValue(3) = rs("Girls")
'FieldValue(4) = rs("Mixed")
'end if
val1=val1+FieldValue(2)
val2=val2+FieldValue(3)
val3=val3+FieldValue(4)
val4=val4+ (FieldValue(2)+FieldValue(3)+FieldValue(4))
response.Write("<tr><td>" & FieldValue(0) & "</td><td> " & FieldValue(1) & "</td><td> " & FieldValue(2) & "</td><td> " & FieldValue(3) & "</td><td>" & FieldValue(4) & "</td><td> " & FieldValue(2)+FieldValue(3)+ FieldValue(4) & "</td></tr>")

rs.movenext
loop
response.Write("<tr><td>Total</td><td></td><td> " & val1 & "</td><td> " & val2 & "</td><td>" & val3 & "</td><td> " & val4 & "</td></tr>")
response.Write("</Table>")
rs.close
%>
</td>
</tr>
</table>
</p>
</body>
</html>

zami
12-14-2010, 01:06 PM
hi Old Pedant
Thanks for your reply, i have done it, i just change data type of 2 fields in main file, distirct and tehsil.
thanks again
bye