随笔分类 - ASP.NET
摘要://在session状态中保存数据库数据 DataView dvMovies; dvMovies = (DataView)Session["Movies"]; if (dvMovies==null) { string constring = "Data Source=.;Initial Catalog=BalloonShop;Integrated Security=True"; SqlDataAdapter dad = new SqlDataAd...
阅读全文
摘要:1//记录页面被请求的次数 int counter = 0; if (Request.Cookies["counter"]!=null) { counter = Int32.Parse(Request.Cookies["counter"].Value);//读取cookies } counter++; Response.Cookies["counter"].Value = counter.ToString();//创建cookies ...
阅读全文
摘要:数据生成树使用存储过程在数据表中生成树数据库 Category1表结构________________________________________CREATE TABLE [dbo].[Category1]( [id] [int] IDENTITY(1,1) NOT NULL, [pid] [int] NULL, [Name] [varchar](100) NULL, [path] [varchar](255) NULL, [sort] [varchar](255) NULL, [isHot] [bit] NULL, [keywords] [text] NULL, [description
阅读全文
摘要:var MyString = "******中华人民共和国******_"; var Myinfo = MyString.Trim("*".ToCharArray()); var Myinfo1 = MyString.Trim(new char[2] { '*', '_' }); Response.Write(MyString + "\n" + Myinfo+"\n"+Myinfo1);******中华人民共和国******_中华人民共和国******_中华人民共和国
阅读全文
摘要:var Mystring = "钓鱼岛是中国的 I love China"; var MyDate = new ASCIIEncoding(); byte[] MyBytes = MyDate.GetBytes(Mystring); var myLength = 0; for (int i = 0; i <= MyBytes.Length - 1; i++) { if (MyBytes[i] == 63)//判断是否为汉字或全脚符号 { myLength++; } myLength++; }
阅读全文
摘要:利用C#代码实现:string Url="www.baidu.com"l;Response.Write("<script language='javascript'>setTimeout(\"{location.href='" + url + "'}\",3000);</script>"); //自动跳转Button1.Attributes.Add("onclick","setTimeout(\"{location.hr
阅读全文

浙公网安备 33010602011771号