Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB.Recordset error '800a0bb9'

Status
Not open for further replies.

Dabase

Programmer
Apr 2, 2004
122
PT
Hi,

I am getting the following error when I tried to spread records to various pages on my ASP page:

ADODB.Recordset error '800a0bb9'

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

/Active/Reports/MarketingSources/MSList_byCode.asp, line 73

Line 73:

Code:
Page_Count = rsCVP.PageCount

Below is the code:

Code:
<body>
  			<!--#include file="adovbs.inc" -->
							

					<% 
						Dim dbCVP
						Dim sql
						Dim RSCVP
						Dim CmdTemp
						Dim Count
						Dim i
						Dim Color
						Dim Page_Size
						Dim Current_Page
						Dim Page_Count

						Page_Size = 15

						If Request("Page") = "" Then
							Current_Page = 1
						Else
							Current_Page = CInt(Request("Page"))
						End If		 
						
						Set dbCVP = Server.createObject("ADODB.Connection")
						dbCVP.open Application("ConnectionString")
						Set CmdTemp = Server.CreateObject("ADODB.Command")
						set rsCVP = server.createobject("adodb.recordset")

						rsCVP.CursorLocation = adUseClient
						rsCVP.Pagesize = Page_Size

						cmdTemp.CommandType = adCmdStoredProc
						cmdTemp.ActiveConnection = dbCVP
						cmdTemp.CommandText = "sp_Marketing_List_by_Codes"
												
						set rsCVP = cmdTemp.Execute


						Page_Count = rsCVP.PageCount
						
						If 1 > Current_Page Then Current_Page = 1
						If Current_Page > Page_Count Then Current_Page = Page_Count

						rsCVP.AbsolutePage = Current_Page
						
										
					%>	

 
				<table border="0" class="style3" align="center">

					<tr>
						<td><b>Source Code</b></td>
						<td><b>Description</b></td>

					</tr>

					<%
					i = 0
					while rsCVP.AbsolutePage = Current_Page AND not rsCVP.eof
						if i Mod 2 = 0 then
							color = "#F8F8F8"
						else
							color = "#CCCCCC"
						end if	

							response.write("<tr bgcolor=" & color & "><td>" & rsCVP("Code") & "</td><td>" & rsCVP("Description") & "</td></tr>") 					
							i = i + 1

					rsCVP.movenext
					wend
					%>
	
				</table>
					<br>

					<%
						If Current_Page <> 1 Then
							Response.Write "<a href=""MSList_byCode.asp?Page="
							Response.Write Current_Page - 1

							' Where an image is available for Next Page use the line below 
							'Response.Write """><img src=""../prev_1.gif"" border=""0""></a>" & vbCrLf

							Response.Write """>Previous Page</a>" & vbCrLf
							Response.Write " " & vbCrLf
						End If

						If Current_Page < Page_Count Then
							Response.Write "<a href=""MSList_byCode.asp?Page="
							Response.Write Current_Page + 1

							' Where an image is available for Previous Page use the line below
							'Response.Write """><img src=""../next_1.gif"" border=""0""></a>" & vbCrLf

							Response.Write """>Next Page</a>" & vbCrLf
						End IF

					%>

					%>	
				


		</body>

Any help on this will be highly appreciated.



Thanks
Dabase
 
check to see if the pagecount object is returning a value

e.g.

Response.Write rsCVP.PageCount
Response.End

I'm guessing it is not and that is causing the error

you may also want to do a bit of a test without the command and use straight SQL

set rsCVP = cmdTemp.Execute "exec sp_Marketing_List_by_Codes"


to call the stored procedure just do a

here is a example of usage
PageCount Property

___________________________________________________________________

onpnt.com
SELECT * FROM programmers WHERE clue > 0
(0 row(s) affected) -->faq333-3811

 
Hi onpnt,

Thanks for the reply, I have tried your suggestion (using straight SQL) and it now works, but I have certain pages that need to pass parameters to a stored procedure in SQL Server, therefore I have to try to get it to work with the command.

Below is the code with the straight SQL (which works):

Code:
<body>
  			<!--#include file="adovbs.inc" -->
							

					<% 
						Dim dbCVP
						Dim sql
						Dim RSCVP
						Dim CmdTemp
						Dim Count
						Dim i
						Dim Color
						Dim Page_Size
						Dim Current_Page
						Dim Page_Count

						Page_Size = 30

						If Request("Page") = "" Then
							Current_Page = 1
						Else
							Current_Page = CInt(Request("Page"))
						End If		 
						
						Set dbCVP = Server.createObject("ADODB.Connection")
						dbCVP.open Application("ConnectionString")
						'Set CmdTemp = Server.CreateObject("ADODB.Command")
						set rsCVP = server.createobject("adodb.recordset")

						rsCVP.CursorLocation = adUseClient
						rsCVP.Pagesize = Page_Size
						rsCVP.CursorType = adOpenstatic

						'cmdTemp.CommandType = adCmdStoredProc
						'cmdTemp.ActiveConnection = dbCVP
						'cmdTemp.CommandText = "sp_Marketing_List_by_Codes"
						
			
						'set rsCVP = cmdTemp.Execute
						
						' rsCVP.CursorType = adOpenStatic

						sql = "select Code, [Description], convert(nvarchar (30), [Updated on], 106) as [Updated on] from M_Sources order by Code" 

						rsCVP.Open sql, dbCVP, adOpenStatic, adLockReadOnly, adCmdText

						'rsCVP.Open

						'Response.Write ("The total number of pages in RSCVP is " & rsCVP.PageCount)
							
						Page_Count = rsCVP.PageCount
						
						If 1 > Current_Page Then Current_Page = 1
						If Current_Page > Page_Count Then Current_Page = Page_Count

						rsCVP.AbsolutePage = Current_Page
						
										
					%>	
  
				<table border="0" class="style3" align="center">

					<tr>
						<td><b>Source Code</b></td>
						<td><b>Description</b></td>

					</tr>

					<%
					i = 0
					while rsCVP.AbsolutePage = Current_Page AND not rsCVP.eof
						if i Mod 2 = 0 then
							color = "#F8F8F8"
						else
							color = "#CCCCCC"
						end if	

							response.write("<tr bgcolor=" & color & "><td>" & rsCVP("Code") & "</td><td>" & rsCVP("Description") & "</td></tr>") 					
							i = i + 1

					rsCVP.movenext
					wend
					%>
	
				</table>
					<center> <p class="style3">

					<%
						If Current_Page <> 1 Then
							Response.Write "<a href=""MSList_byCode.asp?Page="
							Response.Write Current_Page - 1

							' Where an image is available for Next Page use the line below 
							'Response.Write """><img src=""../prev_1.gif"" border=""0""></a>" & vbCrLf

							Response.Write """>Previous Page</a>" & vbCrLf
							Response.Write " " & vbCrLf
						End If

						If Current_Page < Page_Count Then
							Response.Write "<a href=""MSList_byCode.asp?Page="
							Response.Write Current_Page + 1

							' Where an image is available for Previous Page use the line below
							'Response.Write """><img src=""../next_1.gif"" border=""0""></a>" & vbCrLf

							Response.Write """>Next Page</a>" & vbCrLf
						End IF


					%>

Once again thanks for your time on this.

Thanks
Dabase
 
Hi,

I have managed to achieve my goal by changing
Code:
 set rsCVP = cmdTemp.Execute
to
Code:
 rsCVP.Open cmdTemp

Here is the first part of the code:
Code:
<% 
						Dim dbCVP
						Dim sql
						Dim RSCVP
						Dim CmdTemp
						Dim Count
						Dim i
						Dim Color
						Dim Page_Size
						Dim Current_Page
						Dim Page_Count

						Page_Size = 30

						If Request("Page") = "" Then
							Current_Page = 1
						Else
							Current_Page = CInt(Request("Page"))
						End If		 
						
						Set dbCVP = Server.createObject("ADODB.Connection")
						dbCVP.open Application("ConnectionString")
						Set CmdTemp = Server.CreateObject("ADODB.Command")
						set rsCVP = server.createobject("adodb.recordset")

						rsCVP.CursorLocation = adUseClient
						rsCVP.Pagesize = Page_Size
						rsCVP.CursorType = adOpenstatic

						cmdTemp.CommandType = adCmdStoredProc
						cmdTemp.ActiveConnection = dbCVP
						cmdTemp.CommandText = "sp_Marketing_List_by_Codes"
						
			
						'set rsCVP = cmdTemp.Execute
						rsCVP.Open cmdTemp
						
						Page_Count = rsCVP.PageCount
						
						If 1 > Current_Page Then Current_Page = 1
						If Current_Page > Page_Count Then Current_Page = Page_Count

						rsCVP.AbsolutePage = Current_Page
						
										
					%>

Thanks
Dabase
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top