By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,019 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

Updating array

tsubasa
P: 64
I have an array that is in C# using the .Net framwork and I have the code to delete items from the array, but I am trying to figure out how to update an item in the array.

Expand|Select|Wrap|Line Numbers
  1.  
  2. public DataSet GetDataSetCar()
  3.     {
  4.         if (Session["car"] == null)
  5.         {
  6.             DataSet ds = new DataSet();
  7.             DataColumn colID = new DataColumn("ID_Product", System.Type.GetType("System.Int32"), "");
  8.             DataTable dt = new DataTable("Car");
  9.             dt.Columns.Add(colID);
  10.             dt.Columns.Add("Name_Product", System.Type.GetType("System.String"), "");
  11.             dt.Columns.Add("Quantity", System.Type.GetType("System.Int32"), "");
  12.             dt.Columns.Add("Value", System.Type.GetType("System.Double"), "");
  13.             dt.Columns.Add("SubTotal", System.Type.GetType("System.Double"), "Quantity*Value");
  14.             dt.Columns.Add("Total", System.Type.GetType("System.Double"), "SUM(SubTotal)");
  15.             //key field
  16.             DataColumn[] keys = new DataColumn[1];
  17.             keys[0] = colID;
  18.             dt.PrimaryKey = keys;
  19.             ds.Tables.Add(dt);
  20.             Session["car"] = ds;
  21.             return ds;
  22.         }
  23.         else
  24.         {
  25.             return (Session["car"] as DataSet);
  26.         }
  27.     }
  28.  
Kind Regards,

-Tsubasa
Sep 10 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.