using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
FILL_ROTATOR();
}
}
private void FILL_ROTATOR()
{
SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\ahmed\Downloads\websiteRami\websiteRami\rami.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SELECT * FROM Advertisements";
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
adp.Fill(dt);
AdRotator1.DataSource = dt;
AdRotator1.ImageUrlField = "ImageUrl";
AdRotator1.NavigateUrlField = "NavigateUrl";
AdRotator1.DataBind();
}
}
------------
CREATE TABLE Advertisements(
AdID int NOT NULL,
ImageUrl varchar(255) NOT NULL,
NavigateUrl varchar(255) NULL,
AlternateText varchar(255) NULL,
Keyword varchar(255) NULL,
Impressions int NULL
)
0 التعليقات:
إرسال تعليق