Start a new topic

Refreshing data from a bound grid

I'm updating a project and I'm moving my data from a standard dataset over to a VistaDB table.  The control that I'm binding the data to is a Janus Gridex (very similar to the windows datagrid) and I'm using the VisatDb.Extra.VistaDbDataTable to bind to the grid and it is displaying correct.


The problem is when I update the data in the database the data in the grid is not updated.  Even if I call a .refresh or .refetch on the GridEx control I don't see the new information displayed on the screen.


Any thoughts as to why I wouldn't be getting an updated display?


What do you mean you can't do anything with that object?  What are you looking to do that you can't?  It implements the IEditableObject interface which is the correct type for a few cases when running data bound.

Kendall;


I see your point and it looks like my issues are around caching of data in the control.


One last question.  With my controls events I receive a value for the datarow that I'm working on.  When I'm bound to a datatable this is a standard ADO datarow.  When I'm bound to a Vista table I am returned a VistaDB.Extra.Internal.EditableRow.  Unfortunately I can't do anything with this object.


Is there a way to use this object?


Alternatively,  what would be the fastest way to peek into the database given an indexed key to find a single field?  Is DDA faster or should I use ADO?


Thanks for your assistance

We don't document this with VistaDB since it isn't a VistaDB question but rather one for the control vendor.  I realize that sounds like passing the buck but we just can't document how every .NET control works with data (Janus does it differently than Infragistics which is different than DevExpress..)


What you need to consider is there are three pieces at play here - and it's a good & necessary thing.  The Control displays objects in memory (a DataSet or DataTable or an entity collection from EF for example).  Those objects may in turn be related to a database which means there's code to read from the database into them and push updates from them into the database.


Since VistaDB is an ADO.NET data provider (like SQL Server and many other database) you can generally follow guidance for working with ADO.NET data providers and if you are careful to switch types from SQL-Specific types to the general ADO.NET equivalents you can even follow code guidance for accessing data from SQL Server.


In general, if your goal is just to refresh data then you probably have a method somewhere that queries data to get the data table.  When you want to refresh you'll need to do that again, then set that table to the grid.  Most grids (I believe Janus included) have a way of handling this so you don't lose position in the grid if you do something like a begin update/end update call but that's going to be in the grid's documentation.


For information on how to do basic ADO.NET operations with VistaDB see:

http://www.gibraltarsoftware.com/Support/VistaDB/Documentation/WebFrame.html#AdoNet_CommonOperations_ObjectFactory.html


Do you know of any sample code for the correct way to bind a VistaDb table to a control?


The documentation is a little weak in this area

I haven't verified this in a debugger, but short of some magic I'm not aware of you'd need to get the data table to re-query the underlying data source; The GridEx Refetch is telling the grid control to re-read the underlying data it's bound to (the data table) but nothing's getting the data table to requery the underlying database. 

Login to post a comment