Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

About My ShoppingCart?

Posted on 2004-09-02
9
Medium Priority
?
202 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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Accepted Solution

by:
raj3060 earned 1000 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 1000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa‚Ķ
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

885 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