温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:Asp.Net许愿墙系统源码
当前文件路径:XuYuanQiang/index.aspx.cs

1using System; 2
using System.Collections; 3
using System.ComponentModel; 4
using System.Data; 5
using System.Data.OleDb; 6
using System.Drawing; 7
using System.Web; 8
using System.Web.SessionState; 9
using System.Web.UI; 10
using System.Web.UI.WebControls; 11
using System.Web.UI.HtmlControls; 12
using System.Text; 13
namespace pizi 14
{ 15
/// <summary> 16
/// Summary description for Index. 17
/// </summary> 18
public partial class Index : System.Web.UI.Page 19
{ 20
protected System.Web.UI.WebControls.Label Label1; 21
protected Random ran =null; 22
protected Random ranleft=new Random(); 23
protected StringBuilder sb =null; 24
public string str=null; 25
public string stru =null; 26
27
protected void Page_Load(object sender, System.EventArgs e) 28
{ 29
30
DataBinder(); 31
32
} 33
public void DataBinder() 34
{ 35
36
string Constr ="Provider=Microsoft.Jet.OLeDb.4.0;Data source=" + Server.MapPath("Love_Dai.mdb"); 37
string Querystring ="Select top 1000 cid,cdate,cauthor,ccontent,cbcolor,cfcolor from ccc_love order by cID DESC"; 38
OleDbConnection oleconnection = new OleDbConnection(Constr); 39
//OleDbCommand olecommand = new OleDbCommand(Querystring,oleconnection); 40
//oleconnection.Open(); 41
//olecommand.Connection.Close(); 42
OleDbDataAdapter oleda = new OleDbDataAdapter(Querystring,oleconnection); 43
DataSet ds = new DataSet(); 44
oleda.Fill(ds); 45
oleconnection.Close(); 46
ran = new Random(); 47
// string cu =null; 48
// for(int i=0;i<ds.Tables[0].Rows.Count;i++) 49
// { 50
// if(i%10 !=0) 51
// { 52
// cu += ds.Tables[0].Rows[i]["cauthor"].ToString()+" "; 53
// } 54
// else 55
// { 56
// cu +=ds.Tables[0].Rows[i]["cauthor"].ToString()+"<br>"; 57
// } 58
// } 59
// 60
// 61
// StringBuilder sbu = new StringBuilder(); 62
// sbu.Append("<div class='feng' style='position:absolute;left:25px;top:20px;z-index:1;'>"); 63
// sbu.Append("感谢所有参与此活动的的朋友!你们的名字将永久停留在2006祝福墙上<br>"); 64
// sbu.Append("名字列表如下:<br>"); 65
// sbu.Append("<b>"+cu+"</b>"); 66
// sbu.Append("</div>"); 67
// stru =sbu.ToString(); 68
69
int c= ran.Next(1,ds.Tables[0].Rows.Count); 70
for(int i=0 ;i<ds.Tables[0].Rows.Count;i++) 71
{ 72
if(ds.Tables[0].Rows[i]["cauthor"].ToString()!="") 73
{ 74
int leftpx = ranleft.Next(10,750); 75
int toppx = ranleft.Next(100,350); 76
sb = new StringBuilder(); 77
sb.Append("<div id=Idai" + ds.Tables[0].Rows[i]["cid"].ToString() +" class='Cccc'"); 78
sb.Append("style='position:absolute;"); 79
sb.Append("left:"+leftpx+"px;"); 80
sb.Append("top:"+ toppx +"px;"); 81
sb.Append("background-color:"+ ds.Tables[0].Rows[i]["cbcolor"].ToString()+";"); 82
sb.Append("z-index:" + ds.Tables[0].Rows[i]["cid"].ToString() +";'"); 83
sb.Append("onmousedown='getFocus(this)'>"); 84
sb.Append("<table border=0>"); 85
sb.Append("<td style='cursor:move;' width='98%'"); 86
sb.Append("onmousedown=MDown(Idai"+ ds.Tables[0].Rows[i]["cid"].ToString() + ")>"); 87
sb.Append("第["+ds.Tables[0].Rows[i]["cid"].ToString()+"]条 "); 88
sb.Append( ds.Tables[0].Rows[i]["cdate"].ToString() +" "+"</td><td style='cursor:hand;"); 89
sb.Append("' onclick='ssdel()' width='2%'>√</td></tr>"); 90
sb.Append("<tr><td style='height:100px;padding:5px;' colspan='2'>"); 91
sb.Append(ds.Tables[0].Rows[i]["ccontent"].ToString()); 92
sb.Append("<div style='padding:5px;float:right;'>"+ds.Tables[0].Rows[i]["cauthor"].ToString()+"</div></td></tr></table>"); 93
sb.Append("</div>"); 94
str += sb.ToString(); 95
} 96
} 97
98
99
100
101
} 102
103
Web Form Designer generated code 122
} 123
} 124





}