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 &
相关文档:
表:用户号码,登录时间
显示 :每日登录各时间段的登录人数,和每天登录人数
if isnull(object_id('#tb'),'')=''
drop table #tb
CREATE TABLE #tb(列名1 varchar(12),时间 datetime)
INSERT INTO #tb
SELECT '03174190188','2009-11-01 07:17:39.217' UNION ALL
SELECT '015224486575','2009-11-01 08:01:17.153' ......
ORACLE SQL优化
(1) 选择最有效率的表名顺序(只在基于规则的优化器中有效):
ORACLE 的解析器按照从右到左的顺序处理from 子句中的表名,from 子句中写在最后的表
(基础表driving table)将被最先处理,在from 子句中包含多个表的情况下,你必须选择记
录条数最少的表作为基础表。如果有3个以上的表连接查询, 那就需 ......
(1) 选择最有效率的表名顺序(只在基于规则的优化
器中有效):
Oracle
的
解析器按照从右到左的顺序处理from子句中的表名,from子句中写在最后的表(基础表 driving
table)将被最先处理,在from子句中包含多个表的情况下,你必须选择记录条数最少的表作为基础表。假如有3个以上的表连接查询,
那就 ......
-- create by zh
-- n 是作物的时间,x 是希望在几点成熟,返回播种的时间
with t as
(
select 64 n,9 x from dual union all
select 64 n,13 x from dual union all
select 64 n,17 x from dual union all
select 64 n,20 x from dual
)
select '成熟时间:' || lpad(to_char(n),4,' ' ......