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

2010年8月23日

摘要: 分享一下。虽然达不到PHP的microtime()那么强大,但最终结果也能实现我所要求的了;当你知道其方法后会让你好失望:asp.net版的microtime()的实现方法: 程序代码public static string microtime(){//得到1970年的时间戳DateTime timeStamp = new DateTime(1970, 1, 1);//注意这里有时区问题,用now就要减掉8个小时long sec=(DateTime.UtcNow.Ticks - timeStamp.Ticks) / 10000000;int msec = DateTime.UtcNow.Mil 阅读全文

posted @ 2010-08-23 20:49 冷咖啡(子锡) 阅读(253) 评论(0) 推荐(0) 编辑

2010年7月29日

摘要: http://hi.baidu.com/37116566/blog/item/fbedc7ce84e3ab0092457e56.html方法一、System.Net.WebClient WebClientObj = new System.Net.WebClient();System.Collections.Specialized.NameValueCollection PostVars = new System.Collections.Specialized.NameValueCollection();PostVars.Add("A1","0");PostVars.Add("A2","0"); 阅读全文

posted @ 2010-07-29 17:25 冷咖啡(子锡) 阅读(618) 评论(0) 推荐(0) 编辑

2010年7月24日

摘要: 用了 Reflection反射机制,把一个对象的方法函数反射出来using System.Reflection;UsersModel = UsersBLL.GetModel(1);foreach (PropertyInfo pi in UsersModel.GetType().GetProperties()) {object v = pi.GetValue(UsersModel,null);if (Convert.ToString(v) == "") v = "empty";Response.Write(string.Format("{0}={1}br/", pi.Name, v));}. 阅读全文

posted @ 2010-07-24 10:22 冷咖啡(子锡) 阅读(1169) 评论(0) 推荐(0) 编辑

2010年6月3日

摘要: 很不错的验证码显示页getCode.aspx 程序代码using System;using System.Drawing;public partial class Control_getCode : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){createCheckCode(getCode(4));}private string getCode(int num){string codeStr = string.Empty;//为了方便识别去除了 零 和 英文Ostring codeStrTmp 阅读全文

posted @ 2010-06-03 09:22 冷咖啡(子锡) 阅读(155) 评论(0) 推荐(0) 编辑

2010年4月28日

摘要: 没啥,记录的东西。X:\Program Files\Microsoft Visual Studio 9.0\VC#\Snippets\2052\Visual C#vs2008自定义代码段。 阅读全文

posted @ 2010-04-28 21:10 冷咖啡(子锡) 阅读(157) 评论(0) 推荐(0) 编辑

2010年3月19日

摘要: 前台 要设置ShowFooter="True" ,否则默认表头为隐藏的!后台 程序代码private double sum = 0;//取指定列的数据和protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e){if (e.Row.RowIndex = 0){sum += Convert.ToDouble(e.Row.Cells[6].Text);}else if (e.Row.RowType == DataControlRowType.Footer){e.Row.Cells[5].Text = " 阅读全文

posted @ 2010-03-19 20:06 冷咖啡(子锡) 阅读(152) 评论(0) 推荐(0) 编辑

摘要: 程序代码using ...System.Runtime.InteropServices ; public unsafe class Dog { public uint DogBytes, DogAddr;//设置加密狗字节长度和起始地址 public byte[] DogData;//设置数据的长度 public uint Retcode; [DllImport("Win32dll.dll", CharSet = CharSet.Ansi)] public static unsafe extern uint DogRead(uint idogBytes, uint idogAddr, byte 阅读全文

posted @ 2010-03-19 19:42 冷咖啡(子锡) 阅读(2533) 评论(0) 推荐(0) 编辑

2009年8月21日

摘要: 应用程序的配置文件Web.config后,我们会发现以下这段: sessionState   mode="InProc"   stateConnectionString="tcpip=127.0.0.1:42424"   sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"   cookieless="false"   timeout="20" /   这一段就是配置应用程序是如何存储Session信息的了。我们以下的各种操作主要是针对这一段配置展开。让我们先看看这一段配置中所包含的内容的意思。session 阅读全文

posted @ 2009-08-21 09:41 冷咖啡(子锡) 阅读(162) 评论(0) 推荐(0) 编辑

2009年8月5日

摘要: 默认情况下,ViewState是被启用的,比如提交表单后,表单中输入的值会自动保留。但是如果不需要保留,也可以将其禁用,这样可以节省资源。下面3种方式就可以分别禁用某一个控件、某一个页面和整个应用程序的ViewState。1) 控件禁用:将控件的EnableViewState属性设置为false;2) 页面禁用:在页面的Page指令中添加EnableViewState="false";3) 应用程序禁用:在Web.Config文件中添加 程序代码configurationsystem.webpages enableViewState="false" //system.web/c 阅读全文

posted @ 2009-08-05 17:27 冷咖啡(子锡) 阅读(486) 评论(0) 推荐(0) 编辑

2009年8月4日

摘要: .NET Framework 3.0 以上,支持LinQ1,2,3,4,5,2,1,9统计各字符出现次数,语言不限, 程序代码using System.Collections;int[] scores = new int[] { 97, 92, 81, 60 };for (int i = 0; i scores.Length; i++) {int localNum=scores.GetValue(i);IEnumerableint query =from score in scoreswhere score = localNumselect score;int scoreCount = 阅读全文

posted @ 2009-08-04 16:52 冷咖啡(子锡) 阅读(190) 评论(0) 推荐(0) 编辑