思考命运

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年8月17日

摘要: public static byte[] GetFile(string strFileName) { Stream s = new FileStream(strFileName,FileMode.Open); byte[] buffer = new byte[s.Length]; s.Read(buffer,0,(int)s.Length); return buffer; }上面代码从文件生成了字节数组,然后怎样把字节数组保存为文件?public void saveFile(byte[] buffer){Stream s = new FileStream(strFileName, FileMo 阅读全文
posted @ 2012-08-17 13:26 思考命运 阅读(1150) 评论(0) 推荐(0) 编辑

2012年8月16日

摘要: 在sql server 2005 的新方法ROW_NUMBER做一个查询select row_number() over (order by ProductID) as Row,Name from Product可以看到返回结果中每条记录都有一个唯一的表示其序列号的标志。例如我们在分页中要获取的6到第10条记录就可以采用下面的方法select Row,Name from(select ROW_NUMBER() over(order by ProductID) as Row,Name from Product)as ProductsWithRowNumberswhere Row >= 6 阅读全文
posted @ 2012-08-16 02:21 思考命运 阅读(237) 评论(0) 推荐(0) 编辑

摘要: /********************************************************************* InstallSqlState.SQL Installs the tables, and stored procedures necessary for supporting ASP.NET session state. Copyright Microsoft, Inc. All Rights Reserved.********************************************************************... 阅读全文
posted @ 2012-08-16 02:15 思考命运 阅读(480) 评论(0) 推荐(0) 编辑

摘要: 一、 引发 Session 丢失的几种原因动过手写代码的人都知道,Session 丢失是比较常见的事。以下是本人这几年所遇到的,能够引发 Session 丢失的原因,不敢说是百分百,丢失概率还是特别高的。错…,简直可以说是“相…当…”高哇 ^_^"1、 存放 Session 的电脑重启(废话,若这样都不丢,你神仙啊)2、 InProc 模式:aspnet_wp.exe 或 w3wp.exe 在“任务管理器”中或其它情况下导致其进程被终止运行。3、 InProc 模式:修改 .cs 文件后,编译了两次(只编译一次,有时不会丢失)4、 InProc 模式:修改了 Web.config5、 阅读全文
posted @ 2012-08-16 02:12 思考命运 阅读(380) 评论(0) 推荐(0) 编辑

摘要: CustomValidator控件允许您用自定义的验证逻辑创建验证控件。例如,可以创建一个验证控件,该控件检查在文本框中输入的值是否为偶数。创建该控件的标准代码如下所示:<ASP:CustomValidator id="Validator_ID" RunAt="Server"controlToValidate="要验证的控件的ID"onServerValidateFunction="验证函数"errorMessage="错误信息"Display="Static|Dymatic|N 阅读全文
posted @ 2012-08-16 02:07 思考命运 阅读(1068) 评论(0) 推荐(0) 编辑

摘要: URL : 统一资源定位符 (Uniform Resource Locator, URL)完整的URL由这几个部分构成:scheme://host:port/path?query#fragmentscheme = 通信协议 (常用的http,ftp,maito等)host = 主机 (域名或IP)port = 端口号path = 路径query = 查询可选,用于给动态网页(如使用CGI、ISAPI、PHP/JSP/ASP/ASP.NET等技术制作的网页)传递参数,可有多个参数,用”&”符号隔开,每个参数的名和值用”=”符号隔开。fragment = 信息片断字符串,用于指定网络资源中 阅读全文
posted @ 2012-08-16 02:04 思考命运 阅读(520) 评论(0) 推荐(0) 编辑

摘要: <script type="text/javascript"> function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } return null; }</scr 阅读全文
posted @ 2012-08-16 02:02 思考命运 阅读(136) 评论(0) 推荐(0) 编辑

摘要: HTML扩展类的所有方法都有2个参数:以textbox为例子public static string TextBox( this HtmlHelper htmlHelper, string name, Object value, IDictionary<string, Object> htmlAttributes )public static string TextBox( this HtmlHelper htmlHelper, string name, Object value, Object htmlAttributes )这2个参数代表这个html标签的属性集合。使用方法如下 阅读全文
posted @ 2012-08-16 00:00 思考命运 阅读(167) 评论(0) 推荐(0) 编辑

2012年8月15日

摘要: using System; using System.Data; using System.Xml; using System.Data.SqlClient; using System.Collections; using System.Configuration;namespace BookDAL { /// <summary> /// SqlServer数据访问帮助类 /// </summary> public sealed class SqlHelper { #region 私有构造函数和方法private SqlHelper() { }/// <summa 阅读全文
posted @ 2012-08-15 23:57 思考命运 阅读(185) 评论(0) 推荐(0) 编辑

摘要: 不能为空 <input onblur="if(this.value.replace(/^ +| +$/g,'')=='')alert('不能为空!')">只能输入英文和数字<input onblur="if(/[^0-9a-zA-Z]/g.test(value))alert('有错')"><input onkeyup="value=value.replace(/[^0-9a-zA-Z]/g,'')"/><input 阅读全文
posted @ 2012-08-15 15:43 思考命运 阅读(176) 评论(0) 推荐(0) 编辑