Solved

About My ShoppingCart?

Posted on 2004-09-02
9
195 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
query of query sort 6 97
Format results with PHP 3 68
File names with & character 6 70
Animated .jpg? 13 57
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will learn how to count occurrences of each item in an array.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

919 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now