Click to See Complete Forum and Search --> : ADODB.Recordset error '800a0bb9'


UKTamo
02-19-2007, 08:20 AM
Hi

I'm getting the following error:

ADODB.Recordset error '800a0bb9'

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

/basket_util.asp, line 56.

basket_util.asp is shown below and the error line is shown.

<%
'## This page is setup to process the shopper's basket content.
'## It contains all the utility Subroutines and Functions.

'This Sub routine adds a product to shopper's basket
Function FcnAddtoBasket (ConnObj,usr_GUID,prodID,prodname,prodquantity,prodlistprice,prodsaleprice)
dim strAddCode,rsAdd
set rsAdd = server.CreateObject ("ADODB.RECORDSET")

rsAdd.Open "EXEC sproc_addToBasket " & chr(39) & usr_GUID & chr(39) & "," & chr(39) & prodID & chr(39) & "," & chr(39) & prodname & chr(39) & "," & prodquantity & "," & prodlistprice & "," & prodsaleprice,ConnObj

strAddCode = rsAdd("errorcode")
FcnAddtoBasket = strAddCode

rsAdd.Close
set rsAdd = nothing
End Function

'This sub routine deletes the shopper's entire basket content
Function FcnDeleteBasket(ConnObj,usr_GUID,bID)
Dim rsDel
set rsDel = server.CreateObject ("ADODB.recordset")
rsDel.Open "EXEC sproc_deleteBasket " & chr(39) & usr_GUID & chr(39) & "," & bID,ConnObj

FcnDeleteBasket = rsDel("errorcode")
rsDel.Close
Set rsDel = nothing
End Function

'This sub routine deletes the shopper's entire basket content
Function FcnMakeDefBasket(ConnObj,usr_GUID,bID)
Dim rsDef
set rsDef = server.CreateObject ("ADODB.recordset")
rsDef.Open "EXEC sproc_makeDefaultBasket " & chr(39) & usr_GUID & chr(39) & "," & bID,ConnObj

FcnMakeDefBasket = rsDef("errorcode")
rsDef.Close
Set rsDef = nothing
End Function

'this sub updates the shopper's basket
Sub SubUpdateBasket(updStr)
dim updConn
set updConn = server.CreateObject ("ADODB.Connection")
updConn.ConnectionString = strBasketDSN
updConn.Open
updConn.Execute updStr
updConn.Close
Set updConn = nothing
End Sub

'This function gets shopper's basket and returns the recordset to caller
Function FcnGetBasket (ConnObj,usr_GUID)
Dim rsTemp
set rsTemp = server.CreateObject ("ADODB.recordset")
ERROR Line: rsTemp.Open "EXEC sproc_getBasket " & chr(39) & usr_GUID & chr(39),ConnObj 'error line

Set FcnGetBasket = rsTemp
End Function

'This function saves the shopper's current basket
Function FcnSaveBasket (ConnObj,usr_GUID,bName,bID)
Dim rsSave
set rsSave = server.CreateObject ("ADODB.recordset")
rsSave.Open "EXEC sproc_saveBasket " & chr(39) & usr_GUID & chr(39) & "," & chr(39) & bName & chr(39) & "," & bID,ConnObj

FcnSaveBasket = rsSave("errorcode")
rsSave.Close
Set rsSave = nothing
End Function

'This function gets shopper's previously saved baskets, if any
Function FcnGetSavedBaskets (ConnObj,usr_GUID)
Dim rsTempSaved
set rsTempSaved = server.CreateObject ("ADODB.recordset")
rsTempSaved.Open "EXEC sproc_getSavedBaskets " & chr(39) & usr_GUID & chr(39),ConnObj

Set FcnGetSavedBaskets = rsTempSaved
Set rsTempSaved = nothing
End Function

'This sub writes out a generic error message
Sub writeError
Response.Write ("<font color='red'><p>An error occured while processing your basket request!<br>Please contact the site Administrator.<p></font>")
End Sub

'This sub writes out a message for saved baskets
Sub writeSavedBasketMessage
Response.Write ("<h4>Your Saved Baskets</h4><p><font color='brown'>You do not have any saved basket at this time.</font><p>")
End Sub

'This sub writes out a message for attempted duplicate entries
Sub writeDuplicateEntryMessage
Response.Write "<font color='green'>You already have this product in your basket.</font>"
End Sub


'This function returns a 32 character GUID from SQL Server
Function FcnGenerateGUID(ConnObj)
dim strGUID,rsGUID
set rsGUID = server.CreateObject ("ADODB.RECORDSET")
rsGUID.Open "EXEC sproc_createGUID",ConnObj

strGUID = rsGUID("guid")
FcnGenerateGUID = strGUID

rsGUID.Close
set rsGUID = nothing
End Function

'==============================================================
'This subroutine reads the DSN, and open's a
'connection object for the basket page
Sub SubGetDSNCreateConn
strBasketDSN = Application("strBaskDSN")
set BaskConn = server.CreateObject ("ADODB.Connection")
'BaskConn.ConnectionString = "travcart"
BaskConn = "provider=sqloledb;data source=(local);initial catalog=cart;user id=sa;password=password@1;"

BaskConn.Open
End Sub



'This subroutine gets a 32 char guid from SQL and
'writes that value to the shopper's cookie as their shopper ID
Sub SubCreateNReturnGUID
Dim myGuid
'Call function to return a GUID
myGuid = FcnGenerateGUID(BaskConn)
'append created userGuid to cookie...
Response.Cookies ("shopGuid")("Guid") = myGuid
Response.Cookies ("shopGuid").expires = "August 30, 2020"
End Sub

%>

<% Sub BasketHeader 'To display Basket Header %>
<table cellspacing="1" cellpadding="1" border="0" width="500">
<tr bgcolor="gray">
<th><b> <font size="-1" color="#ffffff">Item</font></b></th>
<th><b> <font size="-1" color="#ffffff">Item ID</font></b></th>
<th><b> <font size="-1" color="#ffffff">Qty</font></b></th>
<th><b> <font size="-1" color="#ffffff">Unit<br>Price</font></b></th>
<th><b> <font size="-1" color="#ffffff">Sale<br>Price</font></b></th>
<th><b> <font size="-1" color="#ffffff">Total</font></b></th>
</tr>
<% End Sub %>

<% Sub BasketManager 'To Manage Saved Baskets %>
<P>
<h4>Your Saved Baskets</h4>
<form name="BaskMgr" method="POST" action="basket.asp">
<table cellspacing="2" cellpadding="1" border="0" width="500">
<th align="left" bgcolor="gray"><b> <font size="-1" color="#ffffff">Basket Name</font></b></th>
<th align="left" bgcolor="gray"><b> <font size="-1" color="#ffffff">Date Created</font></b></th>
<th>&nbsp;</th>
<th>&nbsp;</th>
<!-- Loop to populate table -->
<% do
Dim strBName,strDateCreated,intSavedBaskID

intSavedBaskID = rsSavedBaskets("basket_id")
strBName = rsSavedBaskets("basket_name")
strDateCreated = rsSavedBaskets("date_created")
%>
<tr>
<td><%= strBName %></td>
<td><%= strDateCreated %></td>
<td align="center"><a href="basket.asp?btnMkDef=<%= intSavedBaskID %>"><b>Make Default</b></a></td>
<td align="center"><a href="basket.asp?btnDelSaved=<%= intSavedBaskID %>"><b>Delete</b></a></td>

</tr>
<%
rsSavedBaskets.movenext
loop until rsSavedBaskets.eof

rsSavedBaskets.close
set rsSavedBaskets = nothing
%>
<!-- End Loop -->
</table>
</form>
<% End Sub %>


Any help would be appreciated as I'm totally new to ASP and SQL.

Thanks

buntine
02-19-2007, 08:36 AM
This will often occur when you attempt to use an unavailabke/non-existant connection object.

From where is the "FcnGetBasket" function called?

Ensure the connection object exists and has been opened.

Cheers,
Andrew.

UKTamo
02-19-2007, 08:40 AM
Hi

The connection works fine as the basket.asp page works ok. I get the error when i try to use my process.asp page, would it help if you had the code for that?

process.asp:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Process Order</title>
</head>

<body>
<!-- #include file="basket_util.asp" -->
<%
Dim rsBasket,boolBasketExists,itm_Name,itm_ID,itm_lprice
Dim itm_sprice,itm_extprice,itm_qty,bask_name,bask_ID,subtprice

set rsBasket = FcnGetBasket (BaskConn,strShopperGUID)

rsBasket.Movefirst
subtprice = 0
%>
<form action="https://www.paypal.com/uk/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="UKTamo@gmail.com">
<%
Dim Counter
Counter = 1
do 'start basket content loop
'set basket content variables
itm_Name = rsBasket("sku_name")
itm_qty = rsBasket("sku_qty")
itm_extprice = rsBasket("adjusted_price")
subtprice = itm_extprice + subtprice
%>

<input type="hidden" name=<%= "item_name_" & Counter %> value="<%= itm_Name %>">
<input type="hidden" name=<%= "item_price_" & Counter %> value="<%= FormatCurrency(itm_extprice,2) %>">
<input type="hidden" name=<%= "quantity_" & Counter %> value="<%= itm_qty %>">

<% rsBasket.MoveNext
Counter = Counter + 1
loop until rsBasket.EOF

%>
<input type="hidden" name="amount" value=<%= FormatCurrency(subtprice,2) %>>
<input type="hidden" name="upload" value="1">
<input name="submit" type="submit" value="Correct">
<input type="button" name="Incorrect" value="back" language="VBScript" onclick="call window.history.back(1)" />
</form>
</body>
</html>


I'm trying to get it to take in the basket and send the details to paypal. The loop is to create the paypal details for each individual item in the basket. Any ideas?

russell
02-19-2007, 09:13 AM
abandon the string concatenation method u are using to append parameters to your stored proc.

use the command object. a quick search on this forum will show lots of examples.

UKTamo
02-19-2007, 09:16 AM
Ok you lost me :(

When I said I was new to ASP I ment i only started learning it yesterday...

could you mabye give me a bit more guidance?

russell
02-19-2007, 09:56 AM
sure. first though, need to make sure that BaskConn and strShopperGUID are defined and populated. is BaskConn defined in basket_util.asp? does strShopperGUID have a value?

right after this line
Function FcnGetBasket (ConnObj,usr_GUID)
add this

Response.Write "<p style=color:red>ConnObj: " & typeName(ConnObj) & "<br>"
Response.Write "usr_GUID: " & usr_GUID & "</p>"
what gets displayed from that?

UKTamo
02-19-2007, 10:27 AM
ConnObj: String
usr_GUID: 76B20391B33A4CA9BCFEE5C6F7434AEE

russell
02-19-2007, 12:02 PM
see if this works:

Function FcnGetBasket(ConnObj,usr_GUID)
Dim cmd
Dim rs
Dim sp

sp = "sproc_getBasket"

Set cmd = Server.CreateObject("ADODB.Command")
Set rs = Server.CreateObject("ADODB.Recordset")

With cmd
.ActiveConnection = ConnObj
.CommandType = 4
.CommandText = sp

.Parameters.Append .CreateParameter("@paramName", adGUID, adParamInput, 16, usr_GUID)

rs.Open .Execute
End With

Set FcnGetBasket = rs
End Function


couple things:
change @paramName to the name of the param in the stored procedure.
what is the data type of the parameter in the SP? if it is really a GUID, then this should be ok. if it is a varchar change adGUID to adVarChar and the 16 to the actual length of the param as defined by the stored procedure

UKTamo
02-19-2007, 01:06 PM
Errr.....how do you say I'm totally new to SQL.

change @paramName to the name of the param in the stored procedure.

If i knew what the stored param was I could tell you. I can give you access to the database if you want.

Thomas

russell
02-19-2007, 01:15 PM
do u know how to connect to the database in query analyzer? can right-click sp and click script to new window as create to see the SP. or type in sp_helptext sproc_getBasket to see code for it. or just expand SP in object explorer and expand parameters. should see name of param

UKTamo
02-19-2007, 01:40 PM
CREATE PROCEDURE sproc_getBasket
@shopperid varchar(32)

/********************************************************************************************/
/* NAME: sproc_getBasket *********************/
/* CREATED BY: Manny Agrinya ***************************/
/* DESCR: Returns recordset of shopper's default basket ****/
/* RETURNS: Returns recordset of shopper's default basket ****/
/* DATE: 02/27/01 ******************/
/****************************************************************************************/

AS

set nocount on

--get the RS
SELECT bd.basket_id,bd.sku,bd.sku_name,bd.sku_qty,bd.sale_price,bd.list_price,bd.adjusted_price,bt.basket_n ame
FROM basket_detail bd, basket bt
WHERE bd.basket_id = bt.basket_id
AND bt.default_basket = 1
AND bt.shopper_id = @shopperid

set nocount off

GO


That any good?

russell
02-19-2007, 02:11 PM
cool change the line in code i showed above to this

.Parameters.Append .CreateParameter("@shopperid", adVarChar, adParamInput, 32, usr_GUID)

does it work? get any errors?

UKTamo
02-19-2007, 02:16 PM
No it doesnt work, as the basket won't even show any items that I've added. It did this before because I had the wrong connecton string or something.

russell
02-19-2007, 02:24 PM
get any errors?

UKTamo
02-19-2007, 02:26 PM
No nothing at all. If it helps I can give you full access to the server? mabye you can see something i dont?

russell
02-19-2007, 02:36 PM
try executing this in query analyzer

sproc_getBasket '76B20391B33A4CA9BCFEE5C6F7434AEE'

does it return any results?

UKTamo
02-19-2007, 03:08 PM
1012 abc456 Africa: The Art of a Continent 1 19.9900 23.0000 19.9900 1012
1012 FZX194 The way of the Orisa 1 25.9900 31.0000 25.9900 1012


is what it returns

russell
02-19-2007, 04:56 PM
right after this
set rsBasket = FcnGetBasket (BaskConn,strShopperGUID)
do this
Response.Write "<p style=color:red>" & rsBasket.fields(0).value & "</p>"
get any errors? does it write 1012 to the screen?

UKTamo
02-20-2007, 12:51 PM
Where should i put that?