Is there some way to ascertain if the tableadapters underlying data has changed
I am retrieving data from my database using a TableAdapter
. I was wondering if there is some way I can tell (or be informed) that the data has changed and I therefore need to do another Fill
? That way I can just Fill开发者_如何学编程
on demand rather than every time the user requests to see the information and I am forced to do a Fill
before showing the data because I don't know if is current or not.
For the record I am using an ODBC connection string to access a Pervasive PSQL database
EDIT :
I was thinking I could check the last write time of the MKD file to check if this has changed but this doesn't seem to be reliable as it is not written to until the connection is closed. Does anyone know the circumstances when this is written?
No, there isn't. Your datatable is stale the moment it is filled and you won't have any notification from the database that something changed relative to your datatable. You will have to just poll the database yourself and check for changes.
If the table has a LastModified datetime field, you could do a quick scalar query on that and compare it to what the LastModified datetime in your datatable is, if different, then fill.
精彩评论