5/6/11

Data Access Strategies

    • Whether you are running an application, integrating a system, doing business analysis or making a business decision, you need ready access to pertinent information. Storing and finding large amounts of data can be a difficult and time-consuming process, if you do not know what methods would best suit the needs of your company or website. Moreover, some methods may wind up costing your company more than they are worth.

    Store Data in a Dataset

    • By storing your information in a dataset and using an adapter to read and write the information, you will be able to work with multiple tables of results at one time, manipulate data from different sources, exchange data with other applications, and move data between presentation, business, and data tiers in your applications. You will also be able to bind data to certain controls. Moreover, a dataset is easier to work with in programming language because it represents its structure as objects.

    Saving a Dataset

    • If you decide to use a dataset, you can either create it once and save it, or you can create it and have it discarded when the webpage is finished processing. If you store the dataset, you will not need to return to the source to retrieve a few more records. On the other hand, this will consume a lot of memory, and the dataset could potentially become out of sync with the original data source, failing to give you current information. Thus, datasets containing data likely to change frequently should be recreated each time. If you do decide to store a dataset, you can save it on either your server or on the page itself in a hidden field (also called "on the client").

    Direct Database Operations

    • You can also perform operations directly on the database by using a "data command object," which is an SQL statement that allows you to perform commands on and request data from the data source itself. This offers you more functionality, like DDL commands, that you cannot achieve with other methods. You will also have more control over how and when your commands are executed, and, because you will not need the memory for storing a dataset, you will have less overhead. Sometimes, as for Web applications, this method also requires less programming, which can save you both time and money.

  • No comments: