Storing State in Databases

See Also

You can use Visual Basic's ActiveX Data Objects (ADO) technology to store state information for your IIS application in a database. When you store state information in a database, you write records to a database table each time you receive a request from the browser, and retrieve information from those records as needed. This is useful when you have a webclass that is not set up to stay instantiated between requests.

Storing state information in a database involves several things:

Database state storage can allow you to retain information for long periods of time. For example, suppose you are working in an IIS application that manages the transactions and processing associated with an online bookstore. You have a series of pages in your application that gather information about the buyer. You could use databases to store the buyer information offline and save it for future visits by the same user. When a previous user shows up for a subsequent session, even if the next visit is weeks or even months later, the webclass can retrieve the user information from the database by using the login name and password the user supplies.

In addition, you can use the databinding properties of Visual Basic to manage some state. Because webclasses are Visual Basic objects, they can expose properties that can be bound to a database using the DataBinding and DataFormat objects. This means that property values can be transferred between the webclass and the database automatically through getting and setting those properties.

For More Information   For more information on ADO processing, search for "ActiveX Data Objects" in the MSDN Library.