473,379 Members | 1,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

session problem

46
hai guyz..i want to assign order id for customer..here is my code

Expand|Select|Wrap|Line Numbers
  1.  <% 
  2. if Session("OrderNo") = "" then
  3. RANDOMIZE
  4. OrderNo = INT((9999999999 - 1111111111 + 1) * RND + 1111111111)
  5. 'Session("OrderNo") = OrderNo
  6. 'response.write(Session("OrderNo"))
  7. response.write("OrderNo")
  8. end if
  9. Prod_code = request.form("Prod_code")
  10. 'order = Session("OrderNo")
  11. dim objconn
  12. set objconn = Server.CreateObject("ADODB.Connection")
  13. objconn.open "dsn=inkstreets"
  14.  
  15. dim objrs
  16. set objrs = Server.CreateObject("ADODB.Recordset")
  17. objrs.open "select * from Mycart where Prod_code=" & Prod_code , objconn, 1,3
  18. if objrs.eof then
  19. objrs.addnew
  20. objrs("Order_no") = Session("OrderNo")
  21. objrs("Prod_code") = Prod_code
  22.  
  23. objrs("Cart_qty") = 1
  24. objrs.update
  25. 'response.redirect("mycart.asp")
  26. else
  27. 'response.redirect("mycart.asp")
  28. end if
  29. %>
  30.  
but this not work..can u help me sir
Jun 7 '08 #1
3 1302
omerbutt
638 512MB
can you provide the error code or the line code where the error is occouring
Jun 9 '08 #2
DrBunchman
979 Expert 512MB
Yes can you provide more detail when asking a question and please remember to use the code tags.

Dr B
Jun 9 '08 #3
jeffstl
432 Expert 256MB
One thing I see is you are setting your order number = to your generation formula, but the variable you are using is NOT the session variable

Expand|Select|Wrap|Line Numbers
  1. OrderNo = INT((9999999999 - 1111111111 + 1) * RND + 1111111111)
  2.  
This should be

Expand|Select|Wrap|Line Numbers
  1. Session("OrderNo") = INT((9999999999 - 1111111111 + 1) * RND + 1111111111)
  2.  
Perhaps this is where your confusion is?

Modified:
Expand|Select|Wrap|Line Numbers
  1.  
  2. <% 
  3. if Session("OrderNo") = "" then
  4.      RANDOMIZE
  5.      Session("OrderNo") = INT((9999999999 - 1111111111 + 1) * RND + 1111111111)
  6. end if
  7.  
  8. Prod_code = request.form("Prod_code")
  9.  
  10. dim objconn
  11. set objconn = Server.CreateObject("ADODB.Connection")
  12. objconn.open "dsn=inkstreets"
  13.  
  14. dim objrs
  15. set objrs = Server.CreateObject("ADODB.Recordset")
  16. objrs.open "select * from Mycart where Prod_code=" & Prod_code , objconn, 1,3
  17. if objrs.eof then
  18.      objrs.addnew
  19.      objrs("Order_no") = Session("OrderNo")
  20.      objrs("Prod_code") = Prod_code
  21.  
  22.      objrs("Cart_qty") = 1
  23.      objrs.update
  24.  
  25. else
  26.  
  27. end if
  28. %>
  29.  
Jun 9 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Billy Jacobs | last post by:
I am having a problem with my session variable being set to Null for no apparent reason. I am declaring it like the following when the user logs in. dim objUserInfo as new clsUserInfo 'Set...
1
by: Scott Wickham | last post by:
I'm having a problem saving session information on one form and retrieving it on a subsequent form...for only one out of a number of users. Actually, I'm not absolutely certain it's a session...
6
by: Lina Manjarres | last post by:
Hello, I have a session variable in a login page. Then I go to a form page where I uses the ProfileID and the UserID. Then I go to a result page where I would like to use the UserID as a filter,...
7
by: Ottar | last post by:
I've made a program sorting incomming mail in public folder. The function runs every minute by using the form.timer event. In Access XP it runs for weeks, no problem. Access 2003 runs the same...
5
by: Mark Rodrigues | last post by:
Hi Everyone, I have been fighting a problem for a while and I wonder if someone out there can help. This problem has been presented in a number of news postings previously but I am yet to see a...
9
by: William LaMartin | last post by:
I have a problem, mentioned here before, of Session and Application variables disappearing at one site but not at others or on my development computer. The problem is illustrated by an example...
1
by: Werner | last post by:
Hi Patrick! Can you give an example of how to use a frameset inside an aspx-file? When I create a new frameset in Visual Studio.Net it just gives me a htm-File. Or give me a link where I can...
1
by: Johan Nedin | last post by:
Hello! I have a problem with SQLSession state on my ASP.NET pages. SQLSession state behaves very different from InProcess session state, which I think is very bad. I can understand some of...
5
by: Just D. | last post by:
Do we have any access to the Session object from a different Session? The idea is to save Session of a current user and then if he logs in again then return the Session back. It's not a problem to...
7
by: Mr Newbie | last post by:
I have written a Custom Control Menu. Its fairly simple but it works well enough. In order to simplify things I decided to store the Menu1 custom control in Session. In the page load event below,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.