Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
229
Newbie: Problem updating data.
posted

Ok I'm a 10year vet of 'UltraGrid' and new to this 'UltraWinGrid'.  So far I've had a few issues replicating my vb6 functionality that I enjoyed with 'UltraGrid' with 'UltraWinGrid'.  Eventually I learned it was a MS bug with handling Hierical recordsets in a dataset.

To the point.  What on earth am I missing when it comes to binding my datasource, and getting the grid to be able to actually 'update' the data.

My data sources are not the graphical objects, but created on the fly.  Is this a problem?

 

==

Dim ds As New System.Data.DataSet()

Dim dscmd As New System.Data.SqlClient.SqlDataAdapter("SELECT * FROM tblSomeTable", "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=######;Data Source=########;Network Library=DBMSSOCN")

dscmd.Fill(ds, "tblSomeTable")

UltraGrid1.DataSource = ds

UltraGrid1.UpdateMode = Infragistics.Win.UltraWinGrid.UpdateMode.OnRowChange

==

I make a cell change, change rows, and the grid Pen goes away.  But no actual update to the DB is executed.  I tried UltraGrid1.Updatedata() but that had no effect.

 

Suggestions, for the UltraWinGrid.Net Noob?

 

 

  • 469350
    Offline posted

    Just to clarify a little....

    The UltraWinGrid has no connection to the DataBase. It only deals with it's local data source - in this case the DataSet/DataTable.

    The interaction between the DataSet and the back end (the DataBase) is typically handled by the DataAdapter. Just as you use the DataAdapter to retrieve data from the database and populate the DataSet, you need to use the DataAdapter to update the DataBase from the DataSet. The best resource for information on how to do this is Microsoft's documentation on the DataAdapter class.

  • 53790
    Suggested Answer
    posted

    Hi,

    Looking at the provided information, I suppose that maybe you miss to call Update() method of your Adapter. For example you could handel AfterRowUpdate event of your UltraWinGrid and include the code:

    private void ultraGrid2_AfterRowUpdate(object sender, RowEventArgs e)

    {

        this.dscmd.Update(this.ds);

    }

    Please let me know if you have any questions.      

  • 299
    Offline posted

    Your DataAdapter has no defined update commands. Trust me and save yourself some trouble by making a project DataSet, DataTable(s), and using a BindingSource. If you ever want to customize grid layout, I think using an adhoc table might not work well for you.