文章分类 -  A.[Asp.net_C#常见类]

C# 如何实现记住密码功能
摘要:一般通常情况下,都是使用cookie来记录用户名和密码。以下是部分代码:第一登陆时候代码:protected void Page_Load(object sender, EventArgs e) { HttpCookie cookies = Request.Cookies["platform"]; //判断是否有cookie值,有的话就读取出来 if (cookies != null && cookies.HasKeys) { tbxUserName.Text = cookies["Name"]; //tbxPwd.Text= coo.. 阅读全文

posted @ 2011-11-04 09:58 Sue_娜 阅读(772) 评论(0) 推荐(0)

JS验证密码强度
摘要:CSS代码<style type="text/css">.pwd-strength {width:180px;height:20px;line-height:20px}.pwd-strength-box,.pwd-strength-box-low,.pwd-strength-box-med,.pwd-strength-box-hi{color: #464646;text-align: center;width: 30%; float:left; border:solid 1px #CCCCCC}.pwd-strength-box-low{color: #FF00 阅读全文

posted @ 2011-10-14 14:05 Sue_娜 阅读(267) 评论(0) 推荐(0)

C# 绝对路径改成相对路径
摘要:string reportPath=Application.StartupPath.Substring(0,Application.StartupPath.Substring(0,Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));reportPath+=@"\文件名"; 阅读全文

posted @ 2011-04-21 18:44 Sue_娜 阅读(1685) 评论(0) 推荐(0)

C#比较时间大小
摘要:1、比较时间大小的实验 string st1="12:13"; string st2="14:14"; DateTime dt1=Convert.ToDateTime(st1); DateTime dt2=Convert.ToDateTime(st2); DateTime dt3=DateTime.Now; if(DateTime.Compare(d... 阅读全文

posted @ 2010-12-11 10:35 Sue_娜 阅读(25078) 评论(0) 推荐(0)

C#里用DirectoryInfo的GetFiles()获得文件列表
摘要:public enum CharType { Number = 0, Normal = 1 } public class Model { private string _oValue; public string oValue { set { _oValue ... 阅读全文

posted @ 2010-12-07 09:18 Sue_娜 阅读(11853) 评论(0) 推荐(0)

定点执行代码
摘要:经过半天的研究终于搞定了,和大家分享一下。首先纠正一下自己对Application_Start的认识:当网站第一次或新的一次运行时Application_Start中的代码才有可能执行,执行的条件是有人访问网站。没人点击网站任何页面,Application_Start中的代码是不会执行的。上午我在Application_Start中写了代码,写入日志。重启服务器后马上就去看 log日志,发现没写入,很郁闷,后来发现很愚蠢,只有我再次点击了网站,日志才会写入。先写一个类using System; using System.Collections.Generic; using System.Lin 阅读全文

posted @ 2010-12-06 16:32 Sue_娜 阅读(324) 评论(0) 推荐(0)

替换字符串
摘要://第一种: string abc = "……";//你的字符串 abc = abc.Replace("1", "A");//将abc字符串中的 1 替换成 A //第二种 System.Text.RegularExpressions.Regex.Replace("在替的字符串", "要搜索的字符串(这里可以用正则表达式)", "替换的字符串"); //例子 strin... 阅读全文

posted @ 2010-10-19 16:24 Sue_娜 阅读(166) 评论(0) 推荐(0)

C#线程
摘要:private Thread t; public Form1() { InitializeComponent(); ThreadStart ts = new ThreadStart(Do); t = new Thread(ts); t.Start(); timer1.Start(); } public void Do() { while (true) { Timer tm = new System... 阅读全文

posted @ 2010-09-16 17:24 Sue_娜 阅读(166) 评论(0) 推荐(0)

access下的分页方案(仿sql存储过程)
摘要:using System;using System.Collections.Generic;using System.Text;using System.Data;using System.Data.OleDb;using System.Web;/**//// <summary>/// 名称:access下的分页方案(仿sql存储过程)/// 作者:cncxz(虫虫)/// blog:... 阅读全文

posted @ 2010-09-07 16:24 Sue_娜 阅读(252) 评论(0) 推荐(0)

C#验证类 可验证:邮箱,电话,手机,数字,英文,日期,身份证,邮编,网址,IP
摘要:1namespaceYongFa365.Validator2{3usingSystem;4usingSystem.Text.RegularExpressions;56/**////<summary>7///RegExpSoruce:http://regexlib.com/DisplayPatterns.aspx8///Author:柳永法yongfa365http://www.yong... 阅读全文

posted @ 2010-07-12 16:18 Sue_娜 阅读(368) 评论(0) 推荐(0)

图片验证码
摘要:代码 阅读全文

posted @ 2010-04-28 16:14 Sue_娜 阅读(166) 评论(0) 推荐(0)

去掉數組中的重複項
摘要:背景:在人民路程序中 ,一个用户被赋予多种角色。这就涉及到 有些 角色中的 赋予权限是有 相同的,代码 阅读全文

posted @ 2010-04-01 11:56 Sue_娜 阅读(133) 评论(0) 推荐(0)

lastIndexOf 方法
摘要:返回 String 对象中子字符串最后出现的位置。strObj.lastIndexOf(substring[, startindex])参数strObj必选项。String 对象或文字。substring必选项。要在 String 对象内查找的子字符串。startindex可选项。该整数值指出在 String 对象内进行查找的开始索引位置。如果省略,则查找从字符串的末尾开始。说明lastIndex... 阅读全文

posted @ 2010-03-12 10:24 Sue_娜 阅读(314) 评论(0) 推荐(0)

C#验证手机号码(包含13,15,18号码开头)
摘要:首页引用using System.Text.RegularExpressions;代码 阅读全文

posted @ 2010-03-10 15:31 Sue_娜 阅读(658) 评论(0) 推荐(0)

DataSet 写入 Excel
摘要:在 农科院项目中 碰到这个问题之前 用的 DataView 到 Excel 发现 数据 不全,因为翻页 之后改成 这样源代码:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- try { string sql; string Sdate = Con... 阅读全文

posted @ 2010-02-24 10:05 Sue_娜 阅读(269) 评论(0) 推荐(0)

字符:全角转半角
摘要:代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-- /*全角字符从的unicode编码从65281~65374 半角字符从的unicode编码从 33~126 * 差值65248 空格比较特殊,全角为 12288,半角为 32 */ public ... 阅读全文

posted @ 2010-02-23 10:46 Sue_娜 阅读(947) 评论(0) 推荐(0)

根据日期,获得星期几
摘要:/// <summary>根据日期,获得星期几</summary>/// <param name="y">年</param> /// <param name="m">月</param> /// <param name="d">日</param> /// <returns>星期几,1代表星期一... 阅读全文

posted @ 2010-02-22 09:23 Sue_娜 阅读(214) 评论(0) 推荐(0)

执行按钮事件
摘要:private void btn_EqState_Click(object sender, EventArgs e) { SendState(); }执行按钮事件 private void tmr_state_Tick(object sender, EventArgs e) { btn_EqState_Click(sender, e); } 阅读全文

posted @ 2010-01-19 09:57 Sue_娜 阅读(181) 评论(0) 推荐(0)

日志类
摘要:using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.W... 阅读全文

posted @ 2010-01-19 09:30 Sue_娜 阅读(270) 评论(0) 推荐(0)

动态数组设计原理
摘要:C#中所有数据类型都来自Object类,所以数组可以存储不同的类型,但是数组对象一旦创建,长度就不可改变,在实际应用中存在不方便之处。下面例程介绍了一种开发动态数组的方法。 /// <summary>/// ObjArray 的摘要说明。/// 动态数组/// </summary>/// <example>/// ObjectArray DynArr = new... 阅读全文

posted @ 2010-01-15 17:33 Sue_娜 阅读(607) 评论(0) 推荐(0)