易截截图软件、单文件、免安装、纯绿色、仅160KB

C#.NET防止SQL注入式攻击

1  防止sql注入式攻击(可用于UI层控制) #region  防止sql注入式攻击(可用于UI层控制)
  2 
  3   /**/ /// 
  4  ///  判断字符串中是否有SQL攻击代码
  5  /// 
  6  ///  传入用户提交数据
  7  ///  true-安全;false-有注入攻击现有;
  8  public   bool  ProcessSqlStr( string  inputString)
  9    {
 10       string  SqlStr  =   @" and|or|exec|execute|insert|select|delete|update|alter|create|drop|count|\*|chr|char|asc|mid|substring|master|truncate|declare|xp_cmdshell|restore|backup|net +user|net +localgroup +administrators " ;
 11       try
 12         {
 13           if  ((inputString  !=   null )  &&  (inputString  !=  String.Empty))
 14             {
 15               string  str_Regex  =   @" \b( "   +  SqlStr  +   @" )\b " ;
 16 
 17              Regex Regex  =   new  Regex(str_Regex, RegexOptions.IgnoreCase);
 18               // string s = Regex.Match(inputString).Value; 
 19               if  ( true   ==  Regex.IsMatch(inputString))
 20                   return   false ;
 21 
 22 &


相关文档:

航空公司管理系统(VC++ 与SQL 2005)

系统环境:Windows 7
软件环境:Visual C++ 2008 SP1 +SQL Server 2005
本次目的:编写一个航空管理系统
      这是数据库课程设计的成果,虽然成绩不佳,但是作为我用VC++ 以来编写的最大程序还是传到网上,以供参考。用VC++ 做数据库设计并不容易,但也不是不可能。以下是我的程序界面,后面 ......

SQL 每个分类各取2条数据

create table tb (ptoid int,proclassid int,proname varchar(10))
insert tb
select 1,1,'衣服1'
union all
select 2,2,'衣服2'
union all
select 3,3,'衣服3'
union all
select 4,3,'衣服4'
union all
select 5,2,'衣服5'
union all
select 6,2,'衣服6'
union all
select 7,2,'衣服7'
union all
select 8 ......

简单的 sql分页存储过程

【1】
create procedure proc_pager1  
(   @pageIndex int, -- 要选择第X页的数据 
    @pageSize int -- 每页显示记录数 
)  
AS 
BEGIN 
   declare @sqlStr varchar(500)  
   set @sqlStr='select top '+con ......

windows验证方式连接SQL 数据库

C#中以windows验证方式连接SQL server数据库的类。很多人连接数据库时可能都是网上查了然后就连了,对于参数的含义倒是没怎么在意,偶也是(呵呵),当然我们都注重结果嘛,可是这样不容易记忆每次连的时候都是上网查,感觉挺不方便,所以索性查了一下。~~~Integrated Security=True;表示在连接数据库进行身份验证时用wind ......

SQL Server DBA 的工作清单

有许多不同类型的数据库管理员。 一些类型的数据库管理员致力于于开发领域,而其他的一部分更重视数据库性能的调整以及仍然有一部分数据库管理员则致力于管理SQL Server的业务。 依据数据库管理员的工作环境不同,他们将执行一定数量的不同的任务。为了区分所有不同的任务,数据库管理员可能要执行我清单上所列的任务。
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号