The control reads advertisement information from a data source, which contains one or more ad records. You can store ad information in a database table with a specific schema, and then use a data source control to read the ad records at run time. If you have an existing table with ad information, you can map the schema of your table to the fields that are required by the AdRotator control.
You can store ad information in any type of database, as long as you have the corresponding data source control for that database.
To create the database table for ads
If you do not already have a database table that contains the ad information, create a table with the following schema. All columns except ID are optional.
Data types are provided as SQLВ Server types. If you are using a different database, substitute the appropriate corresponding type.
Column name Data type Description
Primary key. This column can have any name.
The relative or absolute URL of the image to display for the ad.
The target URL for the ad. If you do not provide a value, the ad is not a hyperlink.
The text displayed if the image cannot be found. In some browsers, the text is displayed as a ToolTip. Alternate text is also used for accessibility so that users who cannot see the graphic can hear its description read out loud.
A category for the ad on which the page can filter.
A number that indicates the likelihood of how often the ad is displayed. The larger the number, the more often the ad will be displayed. The total of all impressions values in the XML file may not exceed 2,048,000,000 - 1.
The width of the image in pixels.
The height of the image in pixels.
If you have an existing database table with ad information in it, set the following properties of the AdRotator control to map your database table schema to the fields required by the control:
Insert new records into the table with ad information.
To display ads from the database
Place a data source control, such as a or control, onto the page.
Configure the data source control with a connection string and query to select all of the records from the database table you created earlier.
For information about using data source controls, see Data Source Web Server Controls.
Place an AdRotator control on the ASP.NET Web page where you want the ads to appear.
Set the AdRotator control's property to the ID of the data source control that you created earlier in stepВ 1.
When the page runs, the AdRotator control will query the database for the ads and select one to display.