日期:2014-05-17 浏览次数:20431 次
protected void AdRotator1_AdCreated(object sender, AdCreatedEventArgs e) { SqlConnection nn = new SqlConnection(sConnectionString); string sq = "SELECT * from adaptor "; SqlDataAdapter da = new SqlDataAdapter(sq, nn); DataSet ds=new DataSet(); da.Fill(ds); DataTable dd = ds.Tables[0]; string dizhi = dd.Rows[0]["Ad_ImageUrl"].ToString(); e.ImageUrl = "~/Image/"+dizhi+""; e.NavigateUrl = dd.Rows[0]["Ad_NavigateUrl"].ToString(); e.AlternateText = dd.Rows[0]["Ad_AlText"].ToString(); ; Response.Write(dizhi); }
<?xml version="1.0" encoding="utf-8" ?> <Advertisements xmlns="http://schemas.microsoft.com/AspNet/AdRotator-Schedule-File"> <Ad> <ImageUrl>~/Image/ad1.bmp</ImageUrl> <NavigateUrl>http://www.microsoft.com</NavigateUrl> <AlternateText>微软</AlternateText> <Impressions>100</Impressions> </Ad> <Ad> <ImageUrl>~/Image/ad2.bmp</ImageUrl> <NavigateUrl>http://www.asp.net</NavigateUrl> <AlternateText>ASP.NET网站</AlternateText> <Impressions>50</Impressions> </Ad> </Advertisements>