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

浙公网安备 33010602011771号