Hi I have a database to which new data is added every minute. I have a C# datagrid in winform which displays this db table. We refresh this datagrid every 5 minutes. Is there a way I show only the new added data and not the older ones
You can do this thropugh adding timestamp in your database.
By this you can set the limit of timestamp means , you will have to query the database to show only last 5 minutes time stamp's update in your grid.
Can also set the limit in query if its needed to limit the data in gridview.
This you can do in ASP.net as well as winforms.
You can do this by filtering the records descending with the newly generated uniqueId and also get the specific data with some limit (1 -10 the limit can be defined by you).
Related
I want bind data from database in Horizontal format data is in datatbase e.g
EMPLOYEES FROM CLIENT SIDE
Record ACompany BCompany CComapany DCompany
Count 10 20 30 40
We can use 'PIVOT' function in Sql server and get data in horizontal format from database directly.
You can use ListView instead of Gridview which will give you more flexibility in showing the data.
If required you can use Repeater control inside Listview too.
I am with a little issue on handling with one of my applications.
I have a Vessel's historic which is shown on a ListView, but until now I have never needed to show all the data inside this history (the user was using kind of a filter to get what he needed), but now one of the managers want to see all data through the application (they was receiving the full data through an excel report).
The biggest issue is because its 6000 rows with 21 columns each one and when I try to select all the data it takes something between 5 minutes to fully load, but more than that the user need to add new, edit or copy the history, which brings him to a new update on the list with more 5 minutes to load.
I don't quite know how is the best way to handle with this and I wanted your help!
I would actually split the information into sections. Rather than loading 6,000 rows plus columns all at once, why don't you use something like alphabetize the information? Use a different ListView for A-G, then another ListView for H-O, then so on and so forth. That why it would cut down the time it took to query all of the information.
There is a table of account in database it contain 50000 records.
i am showing the record on telerik grid, currently i fetch all 50000 records and display it but it is working slow, so here i want to select records step by step i.e select first 500 and display it on grid and than again fetch next 500 and attached it to grid.
How can i get this implemented using asp.net c#.
You need to use lazy loading, load only those records which you are currently being displayed in the grid, it could be 500 or 10 or 15 depending on your scenario.
The logic should be in the DB to fetch the required number of records. In SQL Server 2012 you can use the OFFSET and FETCH NEXT keywords, in case of older versions you can use ROW_NUMBER.
In telerik grid views, you can configure that how many data you want to be shown in the data grid table and which page are you selected!
So you could send your request to the database by IPagedList.
For example you want to show 500 data per page and you select page 3 between 100 pages (50000 data in 100 pages that each one contains 500 data) and rapidly the data of row number of 1001 to 1500 will be shown (depends on the sorting condition) in the data table grid.
Please see the below atricle from Microsoft:
PagedList Class
I have a editable nested repeater containing the data.I use it for showing the data and also for saving the data which is updated by the user.
I want to detect particular cell/row for which the data has been modified by the user so that I can update only that particular row in the database instead of saving all the data again.
Is there a way to work this out.Which would be the best technique to use ,Javascript or server side code ?
Resource country etc | Week1 Week2 Week3 | Total
ABC XYZ 10 15 20 45
This is the repeater structure.
Middle one (Weeks showing hours worked by resource which is editable) is the nested repeater.
Values can only be changed in the nested repeater.
I maintain unique ID's for each resource in the hidden field.
Can you suggest me some ways to achieve this functionlity ?
This is normally handled by your ORM, but you can implement it yourself if you like. The idea is called 'change tracking', and basically what's commonly done is to retrieve the record from the database, then compare known retrieve values to the new values before saving it again.
Depending on your concurrency strategy, you also might use a hash of the original values that were sent to the client, placed in a hidden field perhaps, which you can then check original vs. currently in the database in order to not accidentally overwrite someone else's changes.
What we're doing - we have some DataGrids bound to some DataViews and when the user hits a 'submit' button we want to pass all the changed rows to a SPROC. There are some complexities here I can't go into detail about but...
what we need - a list of the modified rows ordered by the time they were modified. Is this possible? I doubt it is possible with the current DataView class so I was wondering what other options I have?
Using .NET 4.0
Kind regards,
Fugu
One way could be to manually add a column "ModifiedTime" that will hold the modified date and time. Every time a row is modified, modify the "ModifiedTime" column by updating its value to current date and time. Now you can simply sort by "ModifiedTime" to get required results.