Cursors can be either updateable or non-updateable. If you only need to display information and not diddle with it, the non-updateable is the fastest. The provider simply passes you the data and forgets about it! There is no need to keep tabs on the data to see if it has been changed. Therefore, this is the fastest cursor to use.
Scrollable cursors, which can be updateable or non-updateable, permit you to move (scroll) back and forth in the recordset. If you only need to blast out some data to a grid or HTML page, a non-scrollable cursor will give a performance boost. This is because there is no need to track where you are in the recordset. This is the default. It is identical to the Static except that you can only scroll forward. The fastest cursor this side of the Pecos Mountains.
Keyset-Driven cursors take note of a key you may have in your database. Under normal circumstances, when you request records from a data source, you get the entire package. However, when a Keyset cursor is selected, only the keys are returned, giving a performance boost. Then, when you scroll through the recordset, the data for the keys is retrieved. However, when you first invoke the cursor, both keys and data are returned so you can see something in your bound control. When you scroll, and the data is not in the current batch of data, the Keyset fetches the next block. This way it only has to manage small keys rather than large chunks of data. This is similar to a Dynamic cursor except you can’t see records others add. If another user deletes a record, it is inaccessible from your recordset.
Dynamic and Static cursors determine what data is available in the cursor at any point in time. As the name implies, Static cursors only contain data that was placed in the cursor when it was created. Static cursors use for generating reports or finding data. Additions, changes, or deletions by other users are not visible. However, with a Dynamic cursor, any new records that are added to the recordset are available. Additions and deletions by others are visible. All movement is supported. But some providers don’t support Dynamic cursor type. It’s like a living cursor.
Search You Want
Monthwise Posts
Search Under Category
Posts’ Tags
.Net (223) ADO.NET (10) Air Conditioner (16) Asp.Net (137) Body-Weight (9) C# (39) C Programming Language (23) Data Structure (36) Design Pattern (20) Digital Currency (9) Eating & Drinking (55) Exam 70-511 - TS: Windows Applications Development with Microsoft .NET Framework 4 (18) Exam 70-536 - TS: Microsoft .NET Framework - Application Development Foundation (15) Exam 70-562 - TS: Microsoft .NET Framework 3.5, ASP.NET Application Development (35) Fever (16) Finance (47) Funds (58) General Knowledge (128) GST (11) Insurance (25) Internet Information Services (IIS) (13) Interview Questions and Answers (471) Investment (21) JavaScript (19) Job (60) LINQ (Language Integrated Query) (56) MCPD Web Developer 4.0 Certification (35) Mental Health (13) MVC (156) OOPs (73) Pain (13) PPF (22) Shares (21) Silverlight (12) Skin (22) Software Development Methodology (12) Software Testing (32) SQL (113) TAX (25) TDS (12) Trading (16) Treatment (14) Web-Service (10) Windows Azure (11) Windows Communication Foundation (WCF) (49)
Dont ever use loop if there is another SET based solution, and there almost always is.
Why would people still be using cursors when there are so many better, more performant options?
Yes Marc, You are right cursors are too slow so its best alternate is while loop…