none
how to insert the below data in sql using adapter.insert RRS feed

  • Question

  • order.Fill(orderDataSet.Order);
                

                OrderDataSet.OrderRow r = new OrderDataSet.OrderDataTable().NewOrderRow();
                r.OrderDate = dateTimeInput_OrderDate.Value;
                r.OrderNo = Convert.ToInt64(textBoxOrderNo.Text);

                r.CustomerID = Convert.ToInt32(comboBox_CustomerId.Text);
                r.OrderAmount = Convert.ToDecimal(textBoxTotal.Text);
             

                
                order.Insert(r);   //this is wrong line please give correct one
    Thursday, December 4, 2014 2:40 PM

Answers


  • You could use the Update method:

    var dt = new OrderDataSet.OrderDataTable();
    OrderDataSet.OrderRow r = dt.NewOrderRow();
    r.OrderDate = dateTimeInput_OrderDate.Value;
    r.OrderNo = Convert.ToInt64(textBoxOrderNo.Text);
    r.CustomerID = Convert.ToInt32(comboBox_CustomerId.Text);
    r.OrderAmount = Convert.ToDecimal(textBoxTotal.Text);
    dt.Rows.Add(newPerson);
    dt.AcceptChanges();
    
    order.Update(dt);
    

    Please remember to mark helpful posts as answer and/or helpful.
    • Marked as answer by RAGU DEVA Friday, December 5, 2014 4:58 AM
    Thursday, December 4, 2014 4:30 PM