真爱无限的知识驿站

学习积累技术经验,提升自身能力

c#页面验证类DataValidate代码



using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI.WebControls;
using System.Text.RegularExpressions;
namespace Tools.Common
{
    /// <summary>
    /// 页面验证类
    /// </summary>
    public class DataValidate
    {
        private static Regex RegPhone = new Regex(@"^(1d{10})|(d{3,4}[-]d{6,8})$");
        /// <summary>
        /// 纯数字,无正负号
        /// </summary>
        private static Regex RegNumber = new Regex("^[0-9]+$");
        /// <summary>
        /// 纯数字,可能有正负号
        /// </summary>
        private static Regex RegNumberSign = new Regex("^[+-]?[0-9]+$");
        /// <summary>
        /// 可能有有小数点的数字
        /// </summary>
        private static Regex RegDecimal = new Regex(@"^(d+[.]d+)|(d+)$");
        /// <summary>
        /// 可能有小数点,也有可能有正负号的数字
        /// </summary>
        private static Regex RegDecimalSign = new Regex(@"^[+-]?((d+[.]d+)|(d+))$"); //等价于^[+-]?d+[.]?d+$
        /// <summary>
        /// Email地址
        /// </summary>
        private static Regex RegEmail = new Regex("^[\w-]+@[\w-]+\.(com|net|org|edu|mil|tv|biz|info|com.cn)$");
        /// <summary>
        /// 是否有中文
        /// </summary>
        private static Regex RegCHZN = new Regex("[u4e00-u9fa5]");


生成(c#检查输入数据、web界面控件)代码的存储过程


GO  

/****** 对象:  StoredProcedure [dbo].[pro_GenerateCheckInput_webControl]    脚本日期: 08/13/2012 10:10:16 ******/  

SET ANSI_NULLS ON  

GO  

SET QUOTED_IDENTIFIER ON  

本人写的数据库常用函数(存储过程中经常要用到)

GO  

/****** 对象:  UserDefinedFunction [dbo].[fun_get_LowerFirst]    脚本日期: 08/04/2012 13:03:56 ******/  

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[fun_get_comment]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))  

<< 1 >>

Powered By Z-BlogPHP 1.7.3

Copyright 2024-2027 pukuimin Rights Reserved.
粤ICP备17100155号