I am struggling trying to save the data to the database. Can someone assist me please.
private void SaveUltraButton_Click(object sender, EventArgs e) { this.ultraGrid1.UpdateData(); this.SaveUltraButton.Enabled = false; }
Hi,
The WinGrid only deals with it's local data source. It has no control over the interaction between that data source and the back end (the DataBase). This isn't specific to WinGrid, this is the way DataBinding in DotNet works - the different layers are abstracted.
So UpdateData on the grid commits any pending changes in the grid to the grid's DataSource. But updating the DataBase from the DataSource is outside the grid's purview.
So what's the point of the .UpdateData command, which does nothing; if we have to manaully code / call the dataset update methods.
It seems the new shiny .net native 'UltraWinGrid' is data dumb. Compared to it's predessor 'UltraGrid' it's been nothing but a total unpleasent experience trying to get the new UltraWinGrid to perform basic data actions of the past. Even using the 'ObjectDataSource' that every insists is necessary, you still need to hand code calls to the updates.
Hello Keith,
Have you been able to resolve your issue ? Did you have a time to take a look at the attached sample.
Please if you have any questions, do not hesitate to ask me.
Regards
Could you please provide me more details about your approach that you are using to connect and load data from DataBase. Are you using Entity Data Model or TableAdapter and DataSet or something else?
I made small sample that implements TableAdapter and DataSet. Could you please take a look at the attached sample. There are SQL script that creates a table and inserts some rows. If you want to apply your changes in database, you could use the Update method of your TableAdapter. For example:
private void ultraButton1_Click(object sender, EventArgs e)
{
ultraGrid1.UpdateData();
this.dbRowsTableAdapter.Update(this.testDataSet);
ultraButton1.Enabled = false;
}
Please take a look in the code for more details.
Please let me know if I misunderstood your scenario or if you have any questions.