 |
| ASP E-commerce As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP E-commerce section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 27th, 2003, 02:06 PM
|
|
Registered User
|
|
Join Date: Oct 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Microsoft OLE DB Provider for ODBC Drivers (0x8004
Hi
I am working on Beginning E-Commerce Chapter 8. And I am getting the Microsoft OLE DB Provider for ODBC Drivers (0x80040E21). This is the ASP Page
<% option explicit
' Somewhere to store problems...
Dim problem
Sub AddToProblem(buf)
if problem <> "" then problem = problem & "<br>"
problem = problem & buf
end sub
' Are we trying to set shipping information?
If Request("action") = "confirm" Then
' Loop the shipping parts...
Dim ShippingPart, num
num = 1
For Each ShippingPart in Request("shippingpart")
' Set the ID we chose from the drop down...
Visit.Order.ShippingID(ShippingPart) = Request("shipping")(num)
' Next
num = num + 1
Next
End If
' Do we have any card details?
If Request("action") = "cards" Then
' Check to see If there are any...
If Visit.Customer.HasCards = False Then
' Bounce...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & "?action=getcard"
Else
' Have we been given an address?
If Request("card") <> "" Then
' Did we get a real address, or were we asked to create a new one?
If Request("card") <> "-1" Then
' Set the card...
Visit.Order.CardID = Request("card")
' Then bounce over to confirm the order...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & "?action=confirm"
Else
' Bounce over to get a new card...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & "?action=getcard"
End If
End If
End If
End If
' Do we have any card details?
If Request("action") = "cards" Then
' Check to see If there are any...
If Visit.Customer.HasCards = False Then
' Bounce...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & "?action=getcard"
Else
' Have we been given an address?
If Request("card") <> "" Then
' Did we get a real address, or were we asked to create a new one?
If Request("card") <> "-1" Then
' Set the card...
Visit.Order.CardID = Request("card")
' Then bounce over to confirm the order...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & "?action=confirm"
Else
' Bounce over to get a new card...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & "?action=getcard"
End If
End If
End If
End If
If Request("action") = "addresses" Then
' Check to see if there are any addresses
If Visit.Customer.HasAddresses = False Then
' Bounce...
Response.buffer = True
Response.clear
Response.Redirect Request("script_name") & _
"?action=getaddress&type=" & request("type")
Else
' Have we been given an address?
If Request("address") <> "" Then
' Did we get a real address, or were we asked to create a new one?
If Request("address") <> "-1" Then
' Set the address against the order...
If lcase(Request("type")) = "billing" Then
If(Request("address")<>"") Then
' Set the billing address...
Visit.Order.BillingAddressID = Request("address")
End If
' Then bounce to get the shipping address...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & _
"?action=addresses&type=shipping"
Else
Dim y
Set y=Request ("address")
' Now that we have a shipping address, update the tax rate for
' the order. (In this example, we're just adding a flat rate of
' 17.5% throughout)
' Then bounce to get the payment info...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & "?action=cards"
End If
Else
' Create a new address...
Response.buffer = True
Response.clear
Response.redirect Request("script_name") & _
"?action=getaddress&type=" & Request("type")
End If
End If
End If
End If
' Are we trying to logon? We added this hidden field in our form design.
If Request("logoncustomer") <> "" Then
' Do we have an e-mail?
If Request("email") = "" Then
addtoproblem "You must enter your e-mail address."
End If
If Request("return") = "1" and Request("password") = "" Then
addtoproblem "You must enter your password."
End If
' Did we do it?
If problem = "" Then
' Are we creating a new customer?
Dim customerid
Dim newcustomer
If Request("return") = "0" and Request("password") = "" Then
' Create a new customer?
customerid = Visit.Customers.CreateCustomer(Request("email"))
If customerid = 0 Then
' We already have a customer with that e-mail
addtoproblem "There is already a customer listed " & _
"with that e-mail address. You should log " & _
"into your existing account by entering " & _
"your password."
else
' Tell WroxCommerce what customer we are, and then
' flag us as a new customer
Visit.CustomerID = customerid
newcustomer = True
End If
else
' we need to check the password...
Visit.Customers.CheckLogon Request("email"), Request("password"), _
problem
newcustomer = False
End If
' Bounce if all OK. This prevents confusion with page refreshes.
If problem = "" Then
' Set up for a redirect...
Response.Buffer = True
Response.Clear
' If we're a new customer, we need to bounce to a
' page where we can get the rest of the info, otherwise
' try to capture a billing address...
If newcustomer = True Then
Response.Redirect Request("script_name") & "?action=getname"
Else
Response.Redirect Request("script_name") & _
"?action=addresses&type=billing"
End If
End If
End If
End If
' Do we want to update the customer info?
If Request("updatecustomer") <> "" Then
' Do we have the bits we need?
If Request("firstname") = "" Then
addtoproblem "You must enter your first name."
End If
If Request("lastname") = "" Then
addtoproblem "You must enter your last name."
End If
If Request("password") = "" Then
addtoproblem "You must enter your password."
Else
If LCase(Request("password")) <> LCase(Request("confirm")) Then
addtoproblem "Both passwords you enter must match exactly."
End If
End If
' Did we do it?
If problem = "" Then
' Update the customer. We don't need to update the e-mail...
visit.Customer.Update Request("firstname"), _
Request("lastname"), , Request("password")
' Bounce over to capture the billing address...
Response.Buffer = True
Response.Clear
Response.Redirect Request("script_name") & _
"?action=addresses&type=billing"
End If
End If
' Do we want to create a new address?
If Request("createaddress") <> "" Then
' Do we have the bits we need?
If Request("name") = "" Then
addtoproblem "You must enter a name."
End If
If Request("address1") = "" Then
addtoproblem "You must enter the first address line."
End If
If Request("city") = "" Then
addtoproblem "You must enter the city."
End If
If Request("region") = "" Then
addtoproblem "You must enter the region (or state)."
End If
If Request("postalcode") = "" Then
addtoproblem "You must enter the postal code (or ZIP)."
End If
If Request("country") = "" Then
addtoproblem "You must enter the country."
End If
' Did we do it?
If problem = "" Then
' Update the customer...
Visit.Customers.CreateAddress Visit.CustomerID, _
Request("name"), Request("company"), Request("address1"), _
Request("address2"), Request("city"), Request("region"), _
Request("postalcode"), Request("country"), Request("phone")
' Bounce over to choose the address we want. We pass
' through the type we were working with on the form...
Response.Buffer = True
Response.Clear
Response.Redirect Request("script_name") & _
"?action=addresses&type=" & Request("type")
End If
End If
' Do we want to create a new card?
If Request("createcard") <> "" Then
' Do we have the bits we need?
If Request("type") = "" Then _
addtoproblem "You must select the type of card."
If Request("name") = "" Then _
addtoproblem "You must enter the name on the card."
If Request("number") = "" Then _
addtoproblem "You must enter the number on the card."
If Request("expiresmonth") = "" Then _
addtoproblem "You must enter an expiry month."
If Request("expiresyear") = "" Then _
addtoproblem "You must enter an expiry year."
' Did we do it?
If problem = "" Then
' Update the customer...
Visit.Customers.CreateCard Visit.CustomerID, Request("type"), _
Request("number"), Request("name"), _
Request("expiresmonth"), Request("expiresyear")
' Bounce over to choose the card we want to use...
Response.Buffer = True
Response.Clear
Response.Redirect Request("script_name") & "?action=cards"
End If
End If
%>
<HTML>
<HEAD>
<TITLE><%=g_sitename%></TITLE>
<LINK rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY <%=g_bodytag%>>
Checkout
<br><br>
<% ' What do we want to do?
select case lcase(request("action")) %>
<%' Capture the name of the visitor...
case "getname" %>
<form action="<%=Request("script_name")%>" method=post>
<center>
<table width=400 cellspacing=0 cellpadding=3 bgcolor=#e0e0e0 border=1>
<tr><td><table cellspacing=0 cellpadding=2 width=100%>
<tr><td class=heading colspan=2>
Please tell us a little about yourself...
</td></tr>
<tr><td><br></td></tr>
<% If problem <> "" Then %>
<tr><td bgcolor=#ff0000 class=heading colspan=2>
<%=problem%></td></tr>
<tr><td><br></td></tr>
<% End If %>
<tr><td class=heading>
Your first name:
</td><td>
<input type=text name=firstname value="<%=Request("firstname")%>">
</td></tr>
<tr><td class=heading>
Your last name:
</td><td>
<input type=text name=lastname value="<%=Request("lastname")%>">
</td></tr>
<tr><td class=heading>
Your password:
</td><td>
<input type=password name=password value="<%=Request("password")%>">
</td></tr>
<tr><td class=heading>
Confirm password:
</td><td>
<input type=password name=confirm value="<%=Request("confirm")%>">
</td></tr>
<tr><td><br></td></tr>
<tr><td colspan=2 align=center>
<input type=submit value="Continue">
</td></tr>
<! -- End it -->
</table></td></tr>
</td></tr></table></center>
<input type=hidden name=updatecustomer value=1>
<input type=hidden name=action value="<%=Request("action")%>">
</form>
<% ' place the order...
case "placeorder" %>
<% ' only place the order if we have one...
If Visit.IsOrder = True then Visit.Order.PlaceOrder %>
<table cellspacing=0 cellpadding=0>
<tr><td class=heading>Thank you!</td></tr>
<tr><td class=small>Your order has been placed.</td></tr>
</table>
<% ' Present the order to the user for confirmation...
case "confirm" %>
<form action="<%=Request("script_name")%>" method=post>
<table cellspacing=0 cellpadding=2 width=100% border=0>
<%
' Draw the billing address...
Dim address
set address = Visit.Customers.GetAddress(Visit.Order.BillingAddr essID)
Response.write "<tr><td class=small width=50% colspan=2>"
Response.write "<b>Billing address:</b><br>"
RenderAddress address
address.close
set address = Nothing
' Now draw the shipping address...
set address = Visit.Customers.GetAddress(Visit.Order.ShippingAdd ressID)
Response.write "</td><td class=small width=50% colspan=2>"
Response.write "<b>Shipping address:</b><br>"
RenderAddress address
Response.write "</td></tr>"
address.close
set address = Nothing
%>
<tr><td><br></td></tr>
<%
' Draw the credit card...
Dim card
set card = Visit.Customers.GetCard(Visit.Order.CardID)
Response.write "<tr><td colspan=4 class=small>"
Response.write "<b>Payment details:</b><br>"
Response.write card("nameoncard") & "<br>"
Response.write card("type") & " " & _
Visit.GetSafeCCNumber(card("number")) & "<br>"
Response.write "Expires: " & card("expiresmonth") & "/" & _
card("expiresyear")
Response.write "</td></tr>"
%>
<tr><td><br></td></tr>
<%
Dim parts, partnum, lines, shipping
' We'll be using this to determine how many parts
' need a shipping option set against them...
Dim NumNeedingShippingID
NumNeedingShippingID = 0
' Get the parts back and Then loop them...
set parts = Visit.Order.Parts
partnum = 1
Do While Not parts.EOF
' Draw the part...
Response.write "<tr><td class=heading bgcolor=#000080 colspan=4>"
Response.write "Order Part " & partnum & ""
Response.write "</td></tr>"
' Get the lines in the part...
set lines = Visit.Order.Lines(parts("partid"))
Do While Not lines.EOF
' Draw the line...
Response.write "<tr><td class=small>"
Response.write lines("mfrname") & " " & lines("name")
Response.write "</td><td class=small>"
Response.write lines("quantity")
Response.write "</td><td class=small>"
Response.write FormatPrice(lines("priceeach"))
Response.write "</td><td class=small>"
Response.write FormatPrice(lines("total"))
Response.write "</td></tr>"
' Next
lines.MoveNext
Loop
lines.Close
set Lines = Nothing
' Add the subtotal...
Response.write "<tr bgcolor=#e0e0e0>"
Response.write "<td colspan=3 align=right class=small>"
Response.write "Subtotal: "
Response.write "</td><td class=small>"
Response.write FormatPrice(parts("subtotal"))
Response.write "</td></tr>"
' Draw in the tax...
Response.write "<tr bgcolor=#e0e0e0>"
Response.write "<td colspan=3 align=right class=small>"
Response.write "Tax ("
Response.write FormatNumber(parts("taxrate") * 100, 1)
Response.write "%): "
Response.write "</td><td class=small>"
Response.write FormatPrice(parts("taxcharge"))
Response.write "</td></tr>"
' Start the row to deal with the shipping...
Response.write "<tr bgcolor=#e0e0e0>"
Response.write "<td colspan=3 align=right class=small>"
' First of all, do we know how we're shipping this?
If not isnull(parts("shippingid")) Then
' We know the method and cost - just write it out...
Response.write parts("shippingname")
Response.write "</td><td class=small>"
Response.write FormatPrice(parts("shippingcharge"))
Response.write "</td></tr>"
Else
' Get the possible shipping methods back...
Response.write "Shipping method:"
Response.write "</td><td>"
Response.write "<select name=shipping>"
set shipping = Visit.Orders.GetShipping
do while not shipping.eof
Response.write "<option value=" & shipping("shippingid") & ">"
Response.write shipping("name")
Response.write " (" & formatprice(shipping("charge")) & ")"
Response.write "</option>"
' Next
shipping.MoveNext
loop
shipping.Close
set shipping = Nothing
' Add a hidden field - this will help us match
' choices to parts later...
Response.write "<input type=hidden "
Response.Write "name=shippingpart value=" & parts("partid") & ">"
' Keep track of how many parts need a shipping id...
NumNeedingShippingID = NumNeedingShippingID + 1
End If
' End the shipping row...
Response.write "</td></tr>"
' If we know the shipping we have the grand total...
If not isnull(parts("shippingid")) Then
Response.write "<tr bgcolor=#c0c0c0>"
Response.write "<td colspan=3 align=right class=small>"
Response.write "<b>TOTAL:</b>"
Response.write "</td><td class=small>"
Response.write FormatPrice(parts("total"))
Response.write "</td></tr>"
End If
' Next...
parts.MoveNext
partnum = partnum + 1
Response.write "<tr><td><br></td></tr>"
Loop
parts.Close
Set parts = Nothing
%>
<tr><td><br></td></tr>
<tr><td colspan=4 align=center>
<%
' Do we want to submit the order? If we've specified shipping IDs for
' each part, Then yes we do, otherwise we want to re-run the form
If NumNeedingShippingID <> 0 Then
Response.write "<input type=submit value=""Continue"">"
Response.write "<input type=hidden name=action value=""" & _
Request("action") & """>"
Else
Response.write "<input type=submit value=""Place Order"">"
Response.write "<input type=hidden name=action value=""placeorder"">"
End If
%>
</td></tr>
<! -- End it -->
</table></td></tr>
</form>
<% ' Ask the customer to choose a credit card...
case "cards" %>
<form action="<%=Request("script_name")%>" method=post>
<center><table width=400 cellspacing=0 cellpadding=3 bgcolor=#e0e0e0 border=1>
<tr><td><table cellspacing=0 cellpadding=2 width=100% border=0>
<tr><td class=heading colspan=2>
Please choose a card...
</td></tr>
<tr><td><br></td></tr>
<%
Dim cards
set cards = Visit.Customer.Cards
Do While not cards.EOF
' Draw the radio button...
Response.write "<tr><td align=right>"
Response.write "<input type=radio name=card value=" & _
cards("cardid") & ">"
' Draw the address...
Response.write "</td><td class=small>"
Response.write cards("nameoncard") & "<br>"
Response.write cards("type") & " "
Response.write Visit.GetSafeCCNumber(cards("number"))
Response.Write "<br>"
Response.write "Expires: " & _
cards("expiresmonth") & "/" & cards("expiresyear")
Response.write "</td></tr>"
' Next...
cards.MoveNext
Loop
cards.Close
set cards = Nothing
%>
<tr><td align=right>
<input type=radio name=card value=-1>
</td><td class=small>
Create a new card...
</td></tr>
<tr><td><br></td></tr>
<tr><td colspan=2 align=center>
<input type=submit value="Continue">
</td></tr>
<! -- End it -->
</table></td></tr>
</td></tr></table></center>
<input type=hidden name=action value="<%=Request("action")%>">
</form>
<% ' capture a new credit card...
case "getcard" %>
<form action="<%=Request("script_name")%>" method=post>
<center><table width=400 cellspacing=0 cellpadding=3
bgcolor=#e0e0e0 border=1>
<tr><td><table cellspacing=0 cellpadding=2 width=100%>
<tr><td class=heading colspan=2>
Please enter the credit card information...
</td></tr>
<tr><td><br></td></tr>
<% If problem <> "" Then %>
<tr><td bgcolor=#ff0000 class=heading colspan=2>
<%=problem%></td></tr>
<tr><td><br></td></tr>
<% End If %>
<tr><td class=heading>
Type of card:
</td><td>
<select name=type>
<option value="">(Select)</option>
<option value="visa">Visa</option>
<option value="mastercard">MasterCard</option>
</select>
</td></tr>
<tr><td class=heading>
Name on card:
</td><td>
<input type=text name=name value="<%=Request("name")%>">
</td></tr>
<tr><td class=heading>
Card number:
</td><td>
<input type=text name=number value="<%=Request("number")%>">
</td></tr>
<tr><td class=heading>
Expires (mm/yyyy):
</td><td>
<input type=text name=expiresmonth
value="<%=Request("expiresmonth")%>" size=2>
<input type=text name=expiresyear
value="<%=Request("expiresyear")%>" size=4>
</td></tr>
<tr><td><br></td></tr>
<tr><td colspan=2 align=center>
<input type=submit value="Continue">
</td></tr>
<! -- End it -->
</table></td></tr>
</td></tr></table></center>
<input type=hidden name=createcard value=1>
<input type=hidden name=action value="<%=Request("action")%>">
</form>
<% ' choose the address...
case "addresses" %>
<form action="<%=Request("script_name")%>" method=post>
<center><table width=400 cellspacing=0 cellpadding=3
bgcolor=#e0e0e0 border=1>
<tr><td><table cellspacing=0 cellpadding=2 width=100% border=0>
<tr><td class=heading colspan=2>
Please choose a <%=Request("type")%> address...
</td></tr>
<tr><td><br></td></tr>
<%
Dim addresses
set addresses = Visit.Customer.Addresses
Do While not addresses.EOF
' Draw the radio button...
Response.write "<tr><td align=right>"
Response.write "<input type=radio name=address " & _
"value=" & addresses("addressid") & ">"
' Draw the address...
Response.write "</td><td class=small>"
RenderAddress addresses
Response.write "</td></tr>"
' Next...
addresses.MoveNext
Loop
addresses.Close
set addresses = Nothing
%>
<tr><td align=right>
<input type=radio name=address value=-1>
</td><td class=small>
Create a new address...
</td></tr>
<tr><td><br></td></tr>
<tr><td colspan=2 align=center>
<input type=submit value="Continue">
</td></tr>
<! -- End it -->
</table></td></tr>
</td></tr></table></center>
<input type=hidden name=createaddress value=1>
<input type=hidden name=type value="<%=Request("type")%>">
<input type=hidden name=action value="<%=Request("action")%>">
</form>
<% ' Capture the new address...
case "getaddress" %>
<form action="<%=Request("script_name")%>" method=post>
<center><table width=400 cellspacing=0 cellpadding=3
bgcolor=#e0e0e0 border=1>
<tr><td><table cellspacing=0 cellpadding=2 width=100%>
<tr><td class=heading colspan=2>
Please enter an address...
</td></tr>
<tr><td><br></td></tr>
<% If problem <> "" Then %>
<tr><td bgcolor=#ff0000 class=heading colspan=2>
<%=problem%></td></tr>
<tr><td><br></td></tr>
<% End If %>
<tr><td class=heading>
Name:
</td><td>
<input type=text name=name value="<%=Request("name")%>">
</td></tr>
<tr><td class=std>
Company name:
</td><td>
<input type=text name=company value="<%=Request("company")%>">
</td></tr>
<tr><td class=heading>
Address 1:
</td><td>
<input type=text name=address1 value="<%=Request("address1")%>">
</td></tr>
<tr><td class=std>
Address 2:
</td><td>
<input type=text name=address2 value="<%=Request("address2")%>">
</td></tr>
<tr><td class=heading>
Town/City:
</td><td>
<input type=text name=city value="<%=Request("city")%>">
</td></tr>
<tr><td class=heading>
Region/State:
</td><td>
<input type=text name=region value="<%=Request("region")%>">
</td></tr>
<tr><td class=heading>
Postal code/ZIP:
</td><td>
<input type=text name=postalcode value="<%=Request("postalcode")%>">
</td></tr>
<tr><td class=heading>
Country:
</td><td>
<input type=text name=country value="<%=Request("country")%>">
</td></tr>
<tr><td class=std>
Phone:
</td><td>
<input type=text name=phone value="<%=Request("phone")%>">
</td></tr>
<tr><td><br></td></tr>
<tr><td colspan=2 align=center>
<input type=submit value="Continue">
</td></tr>
<! -- End it -->
</table></td></tr>
</td></tr></table></center>
<input type=hidden name=createaddress value=1>
<input type=hidden name=type value="<%=Request("type")%>">
<input type=hidden name=action value="<%=Request("action")%>">
</form>
<% ' log on the user...
case else %>
<form action="<%=request("script_name")%>" method=post>
<center><table width=400 cellspacing=0 cellpadding=3
bgcolor=#e0e0e0 border=1>
<tr><td><table cellspacing=0 cellpadding=2 width=100%>
<% if problem <> "" then %>
<tr><td bgcolor=#ff0000 class=heading colspan=2>
<%=problem%></td></tr>
<tr><td><br></td></tr>
<% end if %>
<tr><td class=heading>
Your e-mail address:
</td><td>
<input type=text name=email value="<%=request("email")%>">
</td></tr>
<tr><td class=small colspan=2>
<input type=radio name=return value=0>
I have never shopped at Jo's Coffee before
</td></tr>
<tr><td class=small colspan=2>
<input type=radio name=return value=1 checked>
I am a returning customer. My password is:
<input type=password name=password size=10
value="<%=request("password")%>">
</td></tr>
<tr><td><br></td></tr>
<tr><td colspan=2 align=center>
<input type=submit value="Continue">
</td></tr>
<! -- end it -->
</table></td></tr>
</td></tr></table></center>
<input type=hidden name=logoncustomer value=1>
</form>
<% end select %>
<% ' RenderAddress - draws an address...
Sub RenderAddress(address)
Response.write address("name") & "<br>"
If not isnull(address("company")) Then _
Response.write address("company") & "<br>"
If not isnull(address("address1")) Then _
Response.write address("address1") & "<br>"
If not isnull(address("address2")) Then _
Response.write address("address2") & "<br>"
If not isnull(address("city")) Then _
Response.write address("city") & "<br>"
If not isnull(address("postalcode")) Then _
Response.write address("postalcode") & "<br>"
If not isnull(address("country")) Then _
Response.write address("country") & "<br>"
End Sub %>
</BODY>
</HTML>
And I am getting an error at this point: Visit.Order.BillingAddressID = Request("address"). I am running this on Windows 2000 and SQL Server 2000. I have created the ActiveDLL using VB6.0
I am stumped.
Thanks
|
|

November 3rd, 2003, 03:59 PM
|
|
Authorized User
|
|
Join Date: Nov 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Is that all of the error or is there more to it?
Let's see the code for that set method of your DLL(Visit.Order.BillingAddressID).
|
|

March 18th, 2004, 11:40 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I got the same error in this part.
Can anyone help?
Thanks
|
|

March 19th, 2004, 04:43 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
I think the same applies to you as what applied to the OP:
Quote:
quote:Is that all of the error or is there more to it?
Let's see the code for that set method of your DLL(Visit.Order.BillingAddressID).
|
The error occurs in the VB component, but the OP just posted (loads of) code for the ASP page. If you give us more information, we might be able to help.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 19th, 2004, 11:19 AM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Here is code for Visit.Order.Billing.AddressID:
Public Property Get BillingAddressID() As Long
CheckLoad
BillingAddressID = m_BillingAddressID
End Property
Code for CheckLoad:
' CheckLoad - makes sure the property values have been loaded...
Private Sub CheckLoad()
' Have we already loaded?
If m_IsLoaded = False Then
' Get the record back from the Catalog object...
Dim query As Recordset
Set query = m_utility.Visit.Orders.GetOrder(m_ID)
If Not query.EOF Then
' Get the values back...
m_CustomerID = query("customerid")
If Not IsNull(query("cardid")) Then m_CardID = query("cardid")
If Not IsNull(query("billingaddressid")) Then _
m_BillingAddressID = query("billingaddressid")
If Not IsNull(query("shippingaddressid")) Then _
m_ShippingAddressID = query("shippingaddressid")
If Not IsNull(query("created")) Then m_Created = query("created")
If Not IsNull(query("completed")) Then _
m_Completed = query("completed")
m_Status = query("status")
End If
query.Close
Set query = Nothing
' Flag...
m_IsLoaded = True
End If
End Sub
Thanks
|
|

March 19th, 2004, 11:23 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Right. What happens when you "follow the wire"? This code seems unrelated to database errors to me. Maybe GetOrder accesses the database? Or maybe that method calls an other method that calls another method that tries to access the database. The code you posted isn't the cause of your problems, so you'll need to trace the problem until you see where it originates....
What error do you get? It's often easy to propose a solution when the exact error is known.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 19th, 2004, 12:05 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Imar, Thanks for your help!
But I still can't find where's the error.
Here is code for Get order:
Public Property Get Order() As Order
Set Order = New Order
Order.Configure Me, OrderID
End Property
Code for Order.Configure:
' Configure - set up IUtility...
Public Sub Configure(ByVal utility As IUtility, ByVal ID As Long)
' Hold the utility object...
Set m_utility = utility
' Store the ID...
m_ID = ID
End Sub
Thanks
|
|

March 19th, 2004, 12:10 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi again,
I still can't see any code that tries to access a database, and you still haven't posted the exact error message you get.
What's the code for the constructor for the Order object? Do you see any relevant code that tries to return a Recordset or uses an ADODB.Connection?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

March 19th, 2004, 04:33 PM
|
|
Registered User
|
|
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi!
Check tables names and columns names in SQL.The problem shuld be there.
Im done this part it's working great
|
|

March 19th, 2004, 07:57 PM
|
|
Registered User
|
|
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Here is the code access the database:
' BillingAddressID - set the billing address...
Public Property Let BillingAddressID(ByVal newval As Long)
' Open the record and update the values...
Dim query As New Recordset
query.Open "select * from Orders where OrderID=" & m_ID, _
m_utility.DB.DB, adOpenKeyset, adLockOptimistic
query("BillingAddressID") = newval
query.Update
query.Close
Set query = Nothing
End Property
Thanks
|
|
 |