Solved

About My ShoppingCart?

Posted on 2004-09-02
9
200 Views
Last Modified: 2010-04-06
hi ,i develop a shopping cart in ASP.Net ,and I found out a problem ,but i dont know how to solve it ,anyone can help me? My prob is :
In my ShoppingCart ,i create a DataTable ,and use NewRow method to add item into it ,and then bind it to DataGrid ,everything is ok ,but how can i add all the item of that DataTable into my OrderItem table .
 In Case adding 1 Item : I create a Store Procedure and then add that item into my table ,it's easy .
  But how can i add (n) Item into my OrderItem ,that's difficult ,please help me ,i waste me alot of time ,thank you so much
0
Comment
Question by:chuong25
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 2

Expert Comment

by:SeanLWilliams
ID: 11964991
Without seeing how your trying to do things ( Ie sections of code )
I would suggest using SQL statements such as    Insert into TABLENAME Select a, b, c, d  from ShoppingCartTableName where ShoppingCartID = XXX  

something like that , obviously need to replace a lot of the variables
0
 
LVL 11

Expert Comment

by:raj3060
ID: 11968312
If you are using database then add you data to the database, and retreive it back in order table.
If you are not using database or if you don't want to use database then create an array with all data pass it to the order page.
Let me know if you need more clarification.
--Raj
0
 

Author Comment

by:chuong25
ID: 11969897
can you give me an example about an array by C#.THank you so much
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 11

Accepted Solution

by:
raj3060 earned 250 total points
ID: 11973666
Never worked on C#, but here is something I found
++++++
<%@ Page Language="C#" Debug="true" %>
<script runat="server">

public void Page_Load(Object sender, EventArgs E) {

            //string[] args = new string[0];
            string[] args = {"one","two"};

            //show how big array is
            ShowArray(args);

            //create a new array and add a string to it
            string[] newArgs = AddStringToArray(args,"add this");

            //show again
            ShowArray(newArgs);

}

public static string[] AddStringToArray(string[] arr, string newItem) {

      //converst array to arraylist
            ArrayList alArgs = new ArrayList(arr);

            //add item to arraylist
            alArgs.Add(newItem);

            //put arraylist back into new array
            string[] newArray = (string[])alArgs.ToArray(typeof(string));

            //send new array back
            return newArray;

}

public static void ShowArray(string[] arr) {
      HttpContext.Current.Response.Write("Array has " + arr.Length + " items:<br/>");
      for(int x=0; x<arr.Length; x++) {
            HttpContext.Current.Response.Write(" " + x + ": " + arr[x] + "<br/>");
      }
      HttpContext.Current.Response.Write("<br/>");
}

</script>
+++++++++++
See if any of these help you.
Are you using ASP?
If you are then you should be able to set the attributes, abd get the attributes.
--Raj
0
 

Assisted Solution

by:Maldini
Maldini earned 250 total points
ID: 12041802
I'd suggest this article, has c# code.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndive/html/data11082001.asp

Simply do the batch update over to your db table.
0
 
LVL 11

Expert Comment

by:raj3060
ID: 12237470
We did not get response if the suggestions we gave worked or not, I would suggest point split.
-Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question