Mega Code Archive

 
Categories / ASP.Net Tutorial / ASP Net Controls
 

Storing Advertisements in a Database Table

<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server">     <title>AdRotator Database</title> </head> <body>     <form id="form1" runat="server">     <div>     <asp:AdRotator         id="AdRotator1"         DataSourceID="srcAds"         Runat="server" />     <asp:SqlDataSource         id="srcAds"         ConnectionString="Server=.\SQLExpress;Integrated Security=True;             AttachDbFileName=|DataDirectory|AdListDB.mdf;User Instance=True"         SelectCommand="SELECT ImageUrl, Width, Height, NavigateUrl, AlternateText, Keyword, Impressions             FROM AdList"         Runat="server" />     </div>     </form> </body> </html> AdList database table Column Name            Data Type Id                     Int (IDENTITY) ImageUrl             Varchar(250) Width                 Int Height                 Int NavigateUrl             Varchar(250) AlternateText         NVarchar(100) Keyword                 NVarchar(50) Impressions             Int