Solved

About My ShoppingCart?

Posted on 2004-09-02
9
197 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

786 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