Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ADODB.Recordset error '800a0e79' , The operation requested by the application is not allowed if the object is open


Message #1 by "urmilla" <urmi_tikoo@m...> on Sat, 21 Jul 2001 12:42:36
Hello,

   I am using two sql statements 

   First one is finding the no. of subcategories in a particular table.

   Second sql statement is trying to find total count present in each 

   subcategories table.

   I am not getting the count also & for second sql statement it is 

   giving me the error



   ADODB.Recordset error '800a0e79' 



The operation requested by the application is not allowed if the object is 

open.





can anyone please help me

Thanks



Message #2 by "Dallas Martin" <dmartin@z...> on Sat, 21 Jul 2001 11:18:48 -0400
A short code example would help in determining the problem.





----- Original Message -----

From: "urmilla" <urmi_tikoo@m...>

To: "ASP Databases" <asp_databases@p...>

Sent: Saturday, July 21, 2001 12:42 PM

Subject: [asp_databases] ADODB.Recordset error '800a0e79' , The operation

requested by the application is not allowed if the object is open





> Hello,

>    I am using two sql statements

>    First one is finding the no. of subcategories in a particular table.

>    Second sql statement is trying to find total count present in each

>    subcategories table.

>    I am not getting the count also & for second sql statement it is

>    giving me the error

>

>    ADODB.Recordset error '800a0e79'

>

> The operation requested by the application is not allowed if the object is

> open.

>

>

> can anyone please help me

> Thanks

>



Message #3 by "swapna ankireddy" <swapnaankireddy@y...> on Mon, 23 Jul 2001 11:48:48
Hi,

i think u did mistake on opening the recordset.i.e optimistic locking.

that's why u got that type error.



> Hello,

>    I am using two sql statements 

>    First one is finding the no. of subcategories in a particular table.

>    Second sql statement is trying to find total count present in each 

>    subcategories table.

>    I am not getting the count also & for second sql statement it is 

>    giving me the error

> 

>    ADODB.Recordset error '800a0e79' 

> 

> The operation requested by the application is not allowed if the object 

is 

> open.

> 

> 

> can anyone please help me

> Thanks

> 

Message #4 by kalyan_ramji@h... on Mon, 23 Jul 2001 14:56:54
As mentioned, it could be with the locktype and/or keytype. Also, don 

forget to include the adovbs.inc file in your asp page. Typically when you 

open a record set, the options that I think is best is adOpenStatic and 

adLockOptimistic. 



Try that out..Good Luck!!



> Hello,

>    I am using two sql statements 

>    First one is finding the no. of subcategories in a particular table.

>    Second sql statement is trying to find total count present in each 

>    subcategories table.

>    I am not getting the count also & for second sql statement it is 

>    giving me the error

> 

>    ADODB.Recordset error '800a0e79' 

> 

> The operation requested by the application is not allowed if the object 

is 

> open.

> 

> 

> can anyone please help me

> Thanks

> 

Message #5 by urmilla tikoo <urmi_tikoo@m...> on Tue, 24 Jul 2001 03:52:03 -0700 (PDT)
hello,



 i am sending the code.i have also included adovbs.inc file















<%



Dim Connect_String



Dim Page_Size 'variable which holds the number of records to be viewed per page.



Dim Current_Page 'variable which keeps track of which page is the current page.



Dim MyConn



Dim SQL



Dim Page_Count 'variable which stores the number of pages that can be viewed.



Dim sLoginID



Dim sPassword



'if using SQL Server then use



	Connect_String = "DRIVER=SQL Server" & _



	";SERVER=" & sServer & _



	";UID=" & _



	";PWD="  & _



	";DATABASE=xyz"



	Page_Size =16'here we set the number of records viewed per page to 5.



	If Request("Page")="" Then



	Current_Page = 1



	Else



	Current_Page = cint(Request("Page")) 'the CInt function converts the value to an integer.



	End If



	Set MyConn = Server.CreateObject("ADODB.Connection")



	Set RS = Server.CreateObject("ADODB.RecordSet")



	Set RS1 = Server.CreateObject("ADODB.RecordSet")



	MyConn.Open Connect_String



	RS.CursorLocation = adUseClient



	RS1.CursorLocation = adUseClient



	RS1.PageSize = Page_Size



	%>



<!--First Table Formation  -->  



<center>



<table border="0" width="400" height="0">



<tr>



<td width="400" height="19" bgcolor="#001C5A">



<p align="center"><b><font face="Verdana,ArialBlack" size="2"



color="#ffffff">Please choose the Subcategory</font></b></p>



</td>



</tr>



</table>



       <% 



	DIM catid,RS1,SQL1,subcat,subcatid,CountAds



	catid = Request.QueryString("CatID")



	SQL = "SELECT * from subcategory where CatID= " + catid



	RS.Open SQL, MyConn, adOpenStatic, adLockReadOnly, adCmdText



	subcat = RS("SubCategory")



	subcatid = RS("SubCatID")



	



	RS.PageSize = Page_Size



	Page_Count = RS.PageCount



	If 1 >  Current_Page Then Current_Page = 1



	If Current_Page > Page_Count Then Current_Page = Page_Count



	RS.AbsolutePage = Current_Page



	Do While RS.AbsolutePage = Current_Page AND Not RS.EOF



	







	%>		 <!-- Second Table Formation -->



<table border="0" width="400">



<tr>



<td width="400" bgcolor="#E6E2D2" align="left"><font



face="verdana,arial" size="2" color="#2200CC">        



   <a



href="output.asp?PageCont=''&SubCategory=<%=RS("SubCategory")%>"><%=RS("Name") %>



 



</a>



</font>











</td>



</table>



<%	



	RS.Movenext



	SQL1 = "SELECT count(*) as Total from "  &subcat& " where SubCatID like '%" &subcatid&"%'"



	RS1.Open SQL1, MyConn



	do while not rs1.eof



	CountAds = rs1("Total")



	RS1.MoveNext



	%>



	<%=CountAds%>



<%	loop



	Loop



	%>



	<%



		'clean up



		'RS.Close



		'RS1.close



		'Set RS = Nothing



		'Set RS1 = Nothing



		'MyConn.Close



		'Set MyConn = Nothing



		Response.Write "<center>"







		'below is the page navigation.



		'we're using images for Next and Previous. you could easily use simple hyperlinks instead. 



	 If Current_Page <> 1 Then



		 Response.Write "<a href=""subcategory.asp?Page="



		 Response.Write Current_Page - 1



		 Response.Write "&CatID="



		 Response.Write request.querystring("CatID")



		 Response.Write """><b><font face='Verdana' size='2'>Previous</font></a></b>" & vbCrLf



		 Response.Write "  " &  vbCrLf &  vbCrLf



	 End If







		%>



                      
                      
                      



<%



	If Current_Page < Page_Count Then



		 Response.Write "<a href=""subcategory.asp?Page="



		 Response.Write Current_Page + 1



		 Response.Write "&CatID="



		 Response.Write request.querystring("CatID")



		 Response.Write """><b><font face='Verdana' size='2'>Next</font></a></b>" & vbCrLf



	End IF



		



	%>    



_____________________________________________________________

Get email for life---> 



http://www.moombai.com

Message #6 by urmilla tikoo <urmi_tikoo@m...> on Tue, 24 Jul 2001 04:06:22 -0700 (PDT)
hello,



 the code is as follows



i have lot of tables which is stored in a variable "subcategory" .i want that for each table the count should be displayed for eg



tables name are



Entertainment(6)these r counts displayed



Arts(8)



can u help me plz



<%



	Dim Connect_String



	Dim Page_Size 'variable which holds the number of records to be viewed per page.



	Dim Current_Page 'variable which keeps track of which page is the current page.



	Dim MyConn



	'Dim RS



	Dim SQL



	Dim Page_Count 'variable which stores the number of pages that can be viewed.



	'Dim sServer



	Dim sLoginID



	Dim sPassword







	'if using SQL Server then use



	Connect_String = "DRIVER=SQL Server" & _



	";SERVER=" & sServer & _



	";UID=" & _



	";PWD="  & _



	";DATABASE=xyz"



	Page_Size =16'here we set the number of records viewed per page to 5.



	If Request("Page")="" Then



	Current_Page = 1



	Else



	Current_Page = cint(Request("Page")) 'the CInt function converts the value to an integer.



	End If



	Set MyConn = Server.CreateObject("ADODB.Connection")



	Set RS = Server.CreateObject("ADODB.RecordSet")



	Set RS1 = Server.CreateObject("ADODB.RecordSet")



	MyConn.Open Connect_String



	RS.CursorLocation = adUseClient



	RS1.CursorLocation = adUseClient



	RS1.PageSize = Page_Size



	%>



<!--First Table Formation  -->  



<center>



<table border="0" width="400" height="0">



<tr>



<td width="400" height="19" bgcolor="#001C5A">



<p align="center"><b><font face="Verdana,ArialBlack" size="2"



color="#ffffff">Please choose the Subcategory</font></b></p>



</td>



</tr>



</table>



       <% 



	DIM catid,RS1,SQL1,subcat,subcatid,CountAds



	catid = Request.QueryString("CatID")



	SQL = "SELECT * from subcategory where CatID= " + catid



	RS.Open SQL, MyConn, adOpenStatic, adLockReadOnly, adCmdText



	subcat = RS("SubCategory")



	subcatid = RS("SubCatID")



	



	RS.PageSize = Page_Size



	Page_Count = RS.PageCount



	If 1 >  Current_Page Then Current_Page = 1



	If Current_Page > Page_Count Then Current_Page = Page_Count



	RS.AbsolutePage = Current_Page



	Do While RS.AbsolutePage = Current_Page AND Not RS.EOF



	







	%>		 <!-- Second Table Formation -->



<table border="0" width="400">



<tr>



<td width="400" bgcolor="#E6E2D2" align="left"><font



face="verdana,arial" size="2" color="#2200CC">        



   <a



href="output.asp?PageCont=''&SubCategory=<%=RS("SubCategory")%>"><%=RS("Name") %>



 



</a>



</font>











</td>



</table>



<%	



	RS.Movenext



	SQL1 = "SELECT count(*) as Total from "  &subcat& " where SubCatID like '%" &subcatid&"%'"



	RS1.Open SQL1, MyConn



	do while not rs1.eof



	CountAds = rs1("Total")



	RS1.MoveNext



	%>



	<%=CountAds%>



<%	loop



	Loop



	%>



	<%



		'clean up



		'RS.Close



		'RS1.close



		'Set RS = Nothing



		'Set RS1 = Nothing



		'MyConn.Close



		'Set MyConn = Nothing



		Response.Write "<center>"







		'below is the page navigation.



		'we're using images for Next and Previous. you could easily use simple hyperlinks instead. 



	 If Current_Page <> 1 Then



		 Response.Write "<a href=""subcategory.asp?Page="



		 Response.Write Current_Page - 1



		 Response.Write "&CatID="



		 Response.Write request.querystring("CatID")



		 Response.Write """><b><font face='Verdana' size='2'>Previous</font></a></b>" & vbCrLf



		 Response.Write "  " &  vbCrLf &  vbCrLf



	 End If







		%>





<%



	If Current_Page < Page_Count Then



		 Response.Write "<a href=""subcategory.asp?Page="



		 Response.Write Current_Page + 1



		 Response.Write "&CatID="



		 Response.Write request.querystring("CatID")



		 Response.Write """><b><font face='Verdana' size='2'>Next</font></a></b>" & vbCrLf



	End IF



		



	%>    




  Return to Index