Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Development Tools
 Other Development Tools
 How to update mutiple data into sql server
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 06/22/2012 :  06:09:35  Show Profile  Reply with Quote
I am using window phone7 to insert data into sql server
and using below coding to get shopping cart list at listbox.

public List<Order> FindOrder(string custemail, string orderstatus)
   var findorder = from r in order.Orders 
                   where (r.CustEmail  == custemail && r.OrderStatus == orderstatus ) 
                   select r;
   return findorder.ToList();

public pgShopCart()
    var obj = App.Current as App;
    custemail = obj.custEMAIL;
    string orderstatus = "Pending";
    proxy.FindOrderCompleted += new EventHandler<FindOrderCompletedEventArgs>(proxy_FindOrderCompleted);
    proxy.FindOrderAsync(custemail, orderstatus);

void proxy_FindOrderCompleted(object sender, FindOrderCompletedEventArgs e)
    ListBox1.ItemsSource = e.Result;

After that I want to update the orderId status become "success" but I am only able to update 1 row only by using assign listbox1.itemsource into observable collection.

void proxy_FindOrderCompleted(object sender, FindOrderCompletedEventArgs e)
    ListBox1.ItemsSource = e.Result;
    ObservableCollection<Order> Orders = this.ListBox1.ItemsSource as ObservableCollection<Order>;

    foreach (Order order in Orders)
        orderid = order.OrderID;

and this to update row:

public void UpdateOrderStatus(int orderid, string orderstatus, string paymentdate)
    Order data = order.Orders.Single(p => p.OrderID == orderid);
    data.OrderStatus = orderstatus;

private void btnPay_Click(object sender, RoutedEventArgs e)
    proxy.UpdateOrderStatusCompleted += new EventHandler<UpdateOrderStatusCompletedEventArgs>(proxy_UpdateOrderStatusCompleted);
    proxy.UpdateOrderStatusAsync(orderid, orderstatus);

Any idea to edit my coding for update multiple rows into database?

Flowing Fount of Yak Knowledge

2706 Posts

Posted - 10/14/2012 :  11:38:06  Show Profile  Reply with Quote
Though this is very late.

Instead of using LINQ, why not pass the variables to a stored procedure and let it easily do the work for you.

Best wishes

Edited by - afrika on 10/14/2012 11:38:33
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000