This is a migrated thread and some comments may be shown as answers.

Data entry doesn't doesn't update localdb

1 Answer 82 Views
DataEntry
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 26 Apr 2016, 09:41 PM
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?

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Apr 2016, 09:01 AM
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.
Tags
DataEntry
Asked by
Robert
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or