none
Linq and Binding Sorce HELP!! RRS feed

  • Question

  • I have a windows form with TextBox Controls connected to a Employee BindingSource. I need to INSERT/UPDATE data from the Textboxes. I want to know if there if this can be directly done with the Binding source. I have tried the following code, but i get a null value emp and insert is not possible, I would like to know also how the update can be done directly when the Binding Source has the selected data. Help will be greatly appreciated.

     

     

    Empleado emp = new Empleado();

     mantpreDC =

    new mantpreDataContext();

     emp = (

    Empleado)bindingSource1.Current;

    mantpreDC.Empleados.InsertOnSubmit(emp);

    mantpreDC.SubmitChanges();

    Thursday, September 30, 2010 7:30 PM

Answers

All replies

  • Hello,

    Thanks for your thread! If you retrieve data using DataSet and TableAdapter, I strongly recommend you take a look at the following sections on how to insert/save data into database: http://msdn.microsoft.com/en-us/library/ms171932(VS.80).aspx

    Best regards


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    • Marked as answer by liurong luo Friday, October 15, 2010 2:04 AM
    Thursday, October 7, 2010 6:44 AM
  • Hello,

    I'm writing to follow up the thread. Please tell us if you have more concern on the issue. Have you inserted data successfully into database?

    Thanks again!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Tuesday, October 12, 2010 4:38 AM