随笔分类 -  C#

摘要:Global.ascx页面使用以下方法即可捕获应用层没有try cath的错误 protected void Application_Error(Object sender, EventArgs e) { //在出现未处理的错误时运行的代码 Exception ex =... 阅读全文
posted @ 2013-12-25 10:59 顿金 阅读(172) 评论(0) 推荐(0)
摘要:cs代码 /// /// 处理分页检索存储过程(SQL2005) /// /// 需要查询的字段 /// 表名 /// sql条件 /// 排序字符串 /// 当前页 /// 每页记录数 /// 总记录数 /// 总页数 ///... 阅读全文
posted @ 2013-11-12 13:55 顿金 阅读(655) 评论(0) 推荐(0)
摘要:1.C#代码 public int Insert(Entity model) { var parameters = new SqlParameter[] { new SqlParam... 阅读全文
posted @ 2013-07-15 15:08 顿金 阅读(193) 评论(0) 推荐(0)
摘要:protected override void OnLoad(EventArgs e) { userid = PublicFun.GetSessionValue(HttpContext.Current.Session, "member_id", 0... 阅读全文
posted @ 2013-07-12 10:20 顿金 阅读(266) 评论(0) 推荐(0)
摘要:编写程序的时候,经常需要用的项目根目录,自己总结如下: 1、取得控制台应用程序的根目录方法 方法1、Environment.CurrentDirectory 取得或设置当前工作目录的完整限定路径 方法2、AppDomain.CurrentDomain.BaseDirectory 获取基目录... 阅读全文
posted @ 2013-07-05 14:45 顿金 阅读(334) 评论(0) 推荐(0)
摘要:public static int getBrowser(){string BrowserInfo = HttpContext.Current.Request.UserAgent;if (BrowserInfo.Contains("MSIE 7.0")){//IE7return 1;}else if... 阅读全文
posted @ 2013-07-02 15:44 顿金 阅读(167) 评论(0) 推荐(0)
摘要:1. DataTable转IListpublicclassDataTableToListwhereT :new(){//////利用反射将Datatable转换成List模型/////////publicstaticList ConvertToList(DataTabledt){List list ... 阅读全文
posted @ 2013-05-18 13:51 顿金 阅读(1106) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Web.Script.Serialization;using System.Reflection;using ... 阅读全文
posted @ 2013-05-18 13:48 顿金 阅读(349) 评论(0) 推荐(0)
摘要:public partial class frmRename: Form{List ldir;string lastPath;public frmRename(){InitializeComponent();}private void button1_Click(object sender, Eve... 阅读全文
posted @ 2013-05-18 13:45 顿金 阅读(512) 评论(0) 推荐(0)
摘要:双重锁机制namespace Singleton { public class Singleton { //定义一个私有的静态全局变量来保存该类的唯一实例 private static Singleton singleton; //定义一个只读静态对象 ... 阅读全文
posted @ 2013-05-11 16:09 顿金 阅读(188) 评论(0) 推荐(0)
摘要:#include void bubbleSort(intarr[],intcount){ inti = count, j; inttemp; while(i > 0) { for(j = 0; j arr[j + 1]) { temp = arr[j]; ... 阅读全文
posted @ 2013-05-11 15:34 顿金 阅读(175) 评论(0) 推荐(0)
摘要:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingNPOI.SS.UserModel;usingSystem.IO;usingSystem.Data;usingNPOI.HSSF.Us... 阅读全文
posted @ 2013-05-11 15:00 顿金 阅读(202) 评论(0) 推荐(0)
摘要:Connection 物件 Connection 对象主要是开启程序和数据库之间的连结。没有利用连结对象将数据库打开,是无法从数据库中取得数据的。这个物件在ADO.NET的最底层,我们可以自己产生这个对象,或是由其它的对象自动产生。Command 物件 Command 对象主要可以用来对数据库发出一... 阅读全文
posted @ 2013-05-11 14:23 顿金 阅读(116) 评论(0) 推荐(0)
摘要:intmethod(inti) {if(i == 1 || i==2)return1;elsereturnmethod(i-1) + method(i - 2);} 阅读全文
posted @ 2013-04-09 20:02 顿金 阅读(231) 评论(0) 推荐(0)
摘要:(\u3000|\s)(\u3000|\s)* 阅读全文
posted @ 2013-03-27 21:44 顿金 阅读(399) 评论(0) 推荐(0)