V
vinodkus
I M BEGINNER IN ASP
I WANT TO RETURN TOTAL RECORDS FROM A TABLE.
THERE ARE TWO FORMS CLASS1.ASP AND CLASS2.ASP
THROUGH FIRST FORM I JUST POST THE NAME OF TABLE
SO I M WRITING THE CODE OF CLASS2.ASP
<!--#Include File = "Include/iecon.inc"-->
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<%
dim rs,rs1
class AddNum
public function showRecordCount()
tbl = Request.Form("txtTbl")
rs = con.execute("select count(*) from "&tbl)
end function
public function returnRS
tbl = Request.Form("txtTbl")
rs1 = con.execute("select * from "&tbl)
end function
end class
dim obj
set obj = new AddNum
obj.showRecordCount
Response.write("<br>")
Response.write ("Total Record is " & rs(0))
%>
<div align="left">
<table border="1" cellpadding="0" cellspacing="0" style="border-
collapse: collapse" bordercolor="#111111" width="248" height="52"
id="AutoNumber1">
<tr>
<td width="114" height="52">Addition Of Two Number using Object</
td>
<td width="128" height="52"><input type = text name = txtAdd
size="20" value = <%=a%>></td>
</tr>
</table>
</div>
<table border="1" cellpadding="0" cellspacing="0" style="border-
collapse: collapse" bordercolor="#111111" width="48%"
id="AutoNumber2">
<tr>
<td width="33%">Column1 </td>
<td width="33%">Column2</td>
<td width="34%">Column3</td>
</tr>
<%
obj.returnRS
if not rs1.eof then '/*********LINE NO 66 *****************/
while not rs1.eof
%>
<tr>
<td width="33%"><%=rs1(0)%> </td>
<td width="33%"><%=rs1(1)%> </td>
<td width="34%"><%=rs1(2)%> </td>
</tr>
<%
rs1.movenext
wend
end if
%>
</table>
</body>
</html>
MY ERROR IS
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'eof'
/vkasp/aspClass/class2.asp, line 66
BUT WHEN I COMMENT THE IF AND WHILE LOOP PROCEDURE IT GIVES THE FIRST
RECORD BUT I WANT ALL RECORD FROM TABLE.
WHAT IS PROBLEM
PLEASE HELP ME
THANKS
I WANT TO RETURN TOTAL RECORDS FROM A TABLE.
THERE ARE TWO FORMS CLASS1.ASP AND CLASS2.ASP
THROUGH FIRST FORM I JUST POST THE NAME OF TABLE
SO I M WRITING THE CODE OF CLASS2.ASP
<!--#Include File = "Include/iecon.inc"-->
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<%
dim rs,rs1
class AddNum
public function showRecordCount()
tbl = Request.Form("txtTbl")
rs = con.execute("select count(*) from "&tbl)
end function
public function returnRS
tbl = Request.Form("txtTbl")
rs1 = con.execute("select * from "&tbl)
end function
end class
dim obj
set obj = new AddNum
obj.showRecordCount
Response.write("<br>")
Response.write ("Total Record is " & rs(0))
%>
<div align="left">
<table border="1" cellpadding="0" cellspacing="0" style="border-
collapse: collapse" bordercolor="#111111" width="248" height="52"
id="AutoNumber1">
<tr>
<td width="114" height="52">Addition Of Two Number using Object</
td>
<td width="128" height="52"><input type = text name = txtAdd
size="20" value = <%=a%>></td>
</tr>
</table>
</div>
<table border="1" cellpadding="0" cellspacing="0" style="border-
collapse: collapse" bordercolor="#111111" width="48%"
id="AutoNumber2">
<tr>
<td width="33%">Column1 </td>
<td width="33%">Column2</td>
<td width="34%">Column3</td>
</tr>
<%
obj.returnRS
if not rs1.eof then '/*********LINE NO 66 *****************/
while not rs1.eof
%>
<tr>
<td width="33%"><%=rs1(0)%> </td>
<td width="33%"><%=rs1(1)%> </td>
<td width="34%"><%=rs1(2)%> </td>
</tr>
<%
rs1.movenext
wend
end if
%>
</table>
</body>
</html>
MY ERROR IS
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'eof'
/vkasp/aspClass/class2.asp, line 66
BUT WHEN I COMMENT THE IF AND WHILE LOOP PROCEDURE IT GIVES THE FIRST
RECORD BUT I WANT ALL RECORD FROM TABLE.
WHAT IS PROBLEM
PLEASE HELP ME
THANKS