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

BuildQuery A Simple SQL Query Tool

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BuildQuery
{
/// <summary>
/// 使用提供的数据建立一个SQL查询
/// </summary>
public class BuildQuery
{
#region 类的变量
int numFieldsCount, dispos; //字段数量,记录逗号的数量
//
//将所有的字段和值放入到Dictionary集合里,提高操作效率
//
Dictionary<string, string> dicFields = new Dictionary<string, string>(); //字段集合
Dictionary<string, string> dicData = new Dictionary<string, string>(); //值的集合
Dictionary<string, bool> dicQuotes = new Dictionary<string, bool>(); //是否需要引号的集合
//
//条件字段及值的集合
//
List<string> listIDFields = new List<string>(); //字段集合
List<string> listIDValues = new List<string>(); //值的集合
List<bool> listIDQuotes = new List<bool>(); //引号集合
List<string> listIDOperators = new List<string>();//操作符集合

string strTable; //表名
Boolean IdentityCheck; //是否需要返回一个新的实体类
/// <summary>
/// 封装一个是否需要新的实体类
/// </summary>
public Boolean GetIdentity
{
get { return IdentityCheck; }
set { IdentityCheck = value; }
}

/// <summary>
/// 封装返回一个查询的结果
/// </summary>
public string Table
{
get { return strTable; }
set { strTable = value; }
}
#endregion
/// <summary>
/// 类的实例化构造方法
/// </summary>
public BuildQuery()
{
}
/// <summary>
/// 建立一个查询前清除DICTIONARY集合的所有内容
/// </summary>
publ


相关文档:

SQL DELETE from的用法

在某些情况下,我们会需要直接由数据库中去除一些资料。这可以藉由 DELETE from 指令来达成。它的语法是:
DELETE from "表格名"
WHERE {条件}
以下我们用个实例说明。假设我们有以下这个表格:
Store_Information 表格
store_name
Sales
Date
Los Angeles
$1500
Jan-05-1999
San Diego
$250
Jan-0 ......

sql语句 得到 sql server 表中列的类型和说明

通过Sql语句获得 列的类型和说明:
  得到的表头:表名|列名|类型|说明
  1:针对sql server 2000,在sql2000中,使用:sysobjects,syscolumns和sysproperties表
    SELECT o.name as table_name,c.name AS col_name,type_name(c.xtype) AS type_name,isnull(p.value,'') AS col_Pro ......

SQL 注入攻击原理及防护

SQL 注入攻击原理及防护
在确认可以注入的情况下,使用下面的语句:
HTTP://www.163.com/news.asp?id=xx ;and (select count(*) from sysobjects)>0
HTTP://www.163.com/news.asp?id=xx ;and (select count(*) from msysobjects)>0
如果数据库是SQLServer,那么第一个网址的页面与原页面HTTP://www.163.com/news.asp? ......

SQL调优

SQL Server 查询
查询的时候应该尽量按照复合索引中的顺序来做条件查询;(比如IXC中spInterActiveInstance_GetByIDToStat条件and ProcessState<>99的位置);
如果在程序中有For或者是Foreach,在存储过程中又有IF Exists,那就要看是否可以在表中加入复合索引了,IF Not Exists可以转换为IF Exists来使用索引; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号