I have been battling this wish list code for only God knows how long but just can't seem to get over the hump.
First I searched the forum and found wish list functions and subs with dlls by Cassidy.
I just couldn't much with it.
Then gradually, I started putting the pieces together but somehow, just can't seem to cross over the huddle.
Right now, the Add to wish list functionality is working, items are getting inserted into the wish list table.
However, The items are not getting displayed on the screen even the Select * from wishlist table seems fine to me.
The second problem I am having is the delete from Wishlist code.
I keep getting an error that says:
Error Type:
Microsoft JET Database Engine (0x80040E0C)
Command text was not set for the command object.
/WishList.asp, line 28
I have attached the entire code below.
Please, please help... it is really getting desparate now.
It is probably something real simple...but I can't see it.
thanks much in advance
First I searched the forum and found wish list functions and subs with dlls by Cassidy.
I just couldn't much with it.
Then gradually, I started putting the pieces together but somehow, just can't seem to cross over the huddle.
Right now, the Add to wish list functionality is working, items are getting inserted into the wish list table.
However, The items are not getting displayed on the screen even the Select * from wishlist table seems fine to me.
The second problem I am having is the delete from Wishlist code.
I keep getting an error that says:
Error Type:
Microsoft JET Database Engine (0x80040E0C)
Command text was not set for the command object.
/WishList.asp, line 28
I have attached the entire code below.
Please, please help... it is really getting desparate now.
It is probably something real simple...but I can't see it.
thanks much in advance
Code:
<HTML><BODY>
<%
IF session("custid") = "" Then 'We have no value in session
response.redirect "error.asp?msg=" & server.urlencode("some services require you to login or register")
End IF
Set objConn=Server.CreateObject("ADODB.Connection")
objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"DATA SOURCE=" & server.mappath("admin\scart.mdb")
' Did user ask to add any items to the wishlist?
If Request("AddToWishList") <> "" Then
items = Request("AddItem")
If Trim(items) = "" Then
Response.Write "No products given to us to add!!<P>Doing nothing."
Response.End
End If
items = Split( items, ", " ) ' comma-space
For inum = 0 To UBound(items)
SQL = "INSERT INTO WishList (idCustomer, idProduct) " _
& " VALUES(" & Session("custID") & "," & items(inum) & ")"
Next
End If
Set rs = objConn.Execute( SQL )
'response.write SQL
'response.end
' Did user ask to delete any items from the wishlist?
If Request("DeleteFromWishList") <> "" Then
' yep
items = Request("RemoveItem")
If Trim(items) = "" Then
Response.Write "No products given to us to add!!<P>Doing nothing."
Response.End
End If
'Now let's remove an item or items from the wishlist
SQL = "DELETE FROM wishlist " _
& " WHERE idCustomer=" & Session("custID") & " " _
& " AND idProduct IN ('" & Replace( items, ", ", "','" ) & "')"
Set rs = objConn.Execute( SQL )
Response.Write "Removing: " & SQL & "<br/>"
End If ' end of if user asked to remove items
' now show current state of wishlist:
' In this simulation, we can only show the product ID of each...
' in the real thing, the SQL would of course show all relevant info
Response.Write "<HR>"
SQL = "SELECT * FROM wishlist WHERE idCustomer = " & Session("custID") & " "
Set rs = objConn.Execute( SQL )
Response.Write "Getting wishlist: " & SQL & "<HR>"
%>
<FORM>
<TABLE Border=1 CellPadding=5>
<TR>
<TH>Remove<br/>from list</TH>
<TH>Product ID</TH>
<TH>Description</TH>
</TR>
<%
Do While Not rs.EOF
%>
<TR>
<TD><INPUT Type=Checkbox Name="RemoveItem" Value="<%=item%>"></TD>
<TD><%=item%></TD>
<TD> </TD>
</TR>
<%
rs.MoveNext
Loop
rs.Close
objConn.Close
%>
<TR>
<TD Colspan=3> </TD>
</TR>
<TR>
<TD>
<INPUT Type=Submit Name="DeleteFromWishlist"
Value="Remove checked items to wishlist">
</TD>
<TD> </TD>
<TD align=right>
<INPUT Type=Submit Value="Show the list of products"
onClick="this.form.action='productChoices.asp'; return true;">
</TD>
</TR>
</TABLE>
</FORM>
</BODY></HTML>