Data entry doesn't doesn't update localdb

2 posts, 0 answers
  1. Robert
    Robert avatar
    1 posts
    Member since:
    Mar 2016

    Posted 26 Apr Link to this post

    I've bound a RadBinding Navigator and RadDataEntry to a localdb binding source.  At runtime I can browse the db entries but if I make any changes or add a table entry....it isn't saved into the table.  Do I have to do individual insert/update sql for each field?  For some reason, looking at the documentation I thought the changes would be automatically stored?
  2. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 28 Apr Link to this post

    Hello Robert,

    Thank you for writing.

    I have prepared a sample code snippet for your convenience, demonstrating how to update the database when RadDataEntry and RadBindingNavigator use the same BindingSource bound to the Northwind.Products table from a local SQL server. 
    public Form1()
    {
        InitializeComponent();
     
        this.bindingSource1.DataSource = this.productsBindingSource;
        this.radBindingNavigator1.BindingSource = this.bindingSource1;
        this.radDataEntry1.DataSource = this.bindingSource1;
    }
     
    private void Form1_Load(object sender, EventArgs e)
    {
        this.productsTableAdapter.Fill(this.northwindDataSet1.Products);
    }
     
    private void radButton1_Click(object sender, EventArgs e)
    {
        IEditableObject editbaleObject = this.bindingSource1.Current as IEditableObject;
        if (editbaleObject != null)
        {
            editbaleObject.EndEdit();
        }
        DataRowView dataRowView = this.bindingSource1.Current as DataRowView;
        if (dataRowView != null)
        {
            this.productsTableAdapter.Update(dataRowView.Row);
        }
    }

    I hope this information helps. Should you have further questions I would be glad to help.

     Regards,
    Dess
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top