c# - show recent data in data grid view -
i working on windows application.
in application, saving data in database.
and retrieving data in data grid view.
for using following code :
var expenselist = db.sp_todaysexpense().where(a => a.date <= datetime.now.date).tolist(); dgvtodaysexpense.datasource = expenselist;
above code shows data in database. but, want show data added after opening application.
so how can ?
thank in advance.
you need save datetime value in app settings (right click project => propeties => settings ):
note : use scope => user in order able update value.
then in program.cs main method add:
properties.settings.default.lastopenedtime = datetime.now; properties.settings.default.save();
and change query to:
datetime querytime = properties.settings.default.lastopenedtime ; var expenselist = db.sp_todaysexpense().where(a => a.date >= querytime ).tolist(); dgvtodaysexpense.datasource = expenselist;
for more on app settings : read here
Comments
Post a Comment