Net开发日记8
今天做站,兄弟想出一个能动态变换Banner的想法,就是广告可以在后台换,图片和Flash自动判断的,很不错,拿出来分享一下
OleDbDataAdapter selectpicurl = new OleDbDataAdapter("select Purl from picflash where Ptype='index' order by Pid DESC",conn);
DataSet selectpicds = new DataSet();
selectpicurl.Fill(selectpicds);
string flashpicurl = selectpicds.Tables[0].Rows[0][0].ToString(); //图片或flash的url地址
string houzhui = flashpicurl.Substring(flashpicurl.LastIndexOf(".")+1,flashpicurl.Length-flashpicurl.LastIndexOf(".")-1);//url的后缀名
if(houzhui=="jpg"||houzhui=="gif"||houzhui=="png"||houzhui=="jpeg")
{
top_mainPICorFlash = @"<img src='"+flashpicurl+"' width='820' height='280' />";
}
else if(houzhui=="swf")
{
top_mainPICorFlash=@"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0'
width='820' height='280' VIEWASTEXT>
<param name='movie' value='"+flashpicurl+@"' />
<param name='quality' value='high' />
<embed src='"+flashpicurl+@"'quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='820' height='280'></embed></object>";
}