Wrox Programmer Forums
|
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
 
Old February 9th, 2004, 10:56 AM
Registered User
 
Join Date: Feb 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default what and where is wrong with this coding

what i'm trying to do is when user submit the form,automatically the db table is update..

<% IF rsOrder.Fields.Item("stocklist") > 1 Then %>
<% rsOrder.Fields.Item("stocklist") =rsView.Fields.Item("stocklist").Value -1
rsOrder.Update%>

this is the error msg i got.
Error Type:
(0x80020009)
Exception occurred.

-ASPbeginner

 
Old February 9th, 2004, 03:44 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I would suggest storing the value in a variable, properly convert it to a number, and then store it again:

<%
  Dim Stock
  Stock = CInt(rsOrder.Fields.Item("stocklist"))
  If Stock > 1 Then
    rsOrder.Fields.Item("stocklist") = Stock
    rsOrder.Update
  Else

  End If
%>

Why do you open and close so many ASP code blocks? They can all be withing one block of <% and %> tags....

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 11th, 2004, 11:57 AM
Registered User
 
Join Date: Feb 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ic..thank you so much.well i'm a new beginner and just start playing with ASP and i need to build a website that sell book online for my subject's project.now i got the idea how it goes..but can i write this way to make my stock colum in product table automatically substract when user submit their form

<%
  Dim Stock
  Stock = CInt(rsOrder.Fields.Item("stocklist"))
  If Stock > 1 Then

    rsOrder.Fields.Item("stocklist") = Stock - 1
    rsOrder.Update
  Else

  End If
%>



 
Old February 11th, 2004, 02:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Sure, that would certainly work. In fact, that was what I was trying to write, but I forgot to subtract 1 in my code ;)

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 13th, 2004, 12:03 PM
Registered User
 
Join Date: Feb 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

tq so much Imar.tq very2 much.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with coding Gini Visual Studio 2008 2 March 6th, 2009 04:14 PM
Coding Help sugunakar Classic ASP Professional 2 March 30th, 2008 04:42 PM
Help coding here Scoob PHP How-To 3 January 26th, 2006 11:18 AM
coding mdlan PHP Databases 1 May 28th, 2005 07:40 PM
can someone help me in coding this? somanchivasu Access 1 April 5th, 2004 02:41 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.