Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 9th, 2007, 03:02 PM
Authorized User
Points: 483, Level: 7
Points: 483, Level: 7 Points: 483, Level: 7 Points: 483, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2007
Location: Edgewood, NY, USA.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default INSERT Multiple rows to database

Hi All.

I am using .asp classic NOT .NET!

I have a database called "oddlistorders" that users add to it when they shop around and select certain products. Once done, they can view thier cart which is the "oddlistorders" database.

I then need to take all that they ordered which each row has a unique user ID and customer code and pass it to another database called "oddlistprocessed".

They problem is, it works fine if thwy only order ONE item (one row of data), but if they order more than one item, I cant inssert more than one row at a time.

Here is what I use now which works perfectly for ONE item:
<%
Dim quantity
quantity = Request.Form("quantity")

sql= "Update oddlist Set quantity='"& quantity & "' WHERE user_ID=" & ID

Rs.Open sql, Conn
Conn.Close
Set Rs=Nothing
Set Conn = Nothing

%>

Thanks!!
Reply With Quote
  #2 (permalink)  
Old April 9th, 2007, 03:19 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

cross post
http://p2p.wrox.com/topic.asp?TOPIC_ID=58829

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
Reply With Quote
  #3 (permalink)  
Old April 10th, 2007, 08:53 AM
Authorized User
 
Join Date: Jan 2007
Location: , , USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jonsey Send a message via Yahoo to jonsey
Default

I normally use Class but it think this may help or at less give you some option I have used the With method to right multi rows to DB

Code:

            <%
Dim quantity
quantity = Request.Form("quantity")

sql= "Update oddlist Set quantity='"& quantity & "' WHERE user_ID=" & ID

Rs.Open sql, Conn

With Rs
.AddNew()
                    .Fields("DBField1") = Request.Form("FormData1")
                    .Fields("DBField2") = Request.Form("FormData2")
                    .Fields("DBField3") = Request.Form("FormData3")
                    .Fields("DBField4") = Request.Form("FormData4")

                .Update()
End With

Conn.Close
Set Rs=Nothing
Set Conn = Nothing

%>


Reply With Quote
  #4 (permalink)  
Old April 10th, 2007, 09:03 AM
Authorized User
Points: 483, Level: 7
Points: 483, Level: 7 Points: 483, Level: 7 Points: 483, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2007
Location: Edgewood, NY, USA.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks "Jonsey". But I wont now how many fields are being updated. One session can be 1 row, thext session can be 12 rows. So then how do i number the .AddNew()?

does this make sense?
The data is coming from a shopping cart, so we dont know how many rows for each customer to pass

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
About Insert Multiple Rows of GridView to Databas divekar.vishal ASP.NET 2.0 Professional 0 April 30th, 2008 12:28 AM
INSERT multiple rows to a table nvillare Oracle 7 November 3rd, 2007 04:47 AM
INSERT Multiple rows to database at one time melkin Classic ASP Databases 19 April 11th, 2007 08:22 AM
insert rows in database in a bulk from grid harrysingh26 ASP.NET 2.0 Professional 6 March 6th, 2006 11:46 AM
database lookup functiod (multiple rows) amitagg Biztalk 0 April 12th, 2004 07:20 PM



All times are GMT -4. The time now is 05:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.