通用的SqlServer操控类
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
public class CommandInfo
{
public string CommandText;
public SqlParameter[] Parameters;
}
/// <summary>
/// 数据访问抽象基础类
/// </summary>
public abstract class DbHelperSQL
{
//数据库连接字符串(web.config来配置),可以动态更改connectionString支持多数据库.
public static string connectionString = ConfigurationManager.ConnectionStrings["cnpg_newsConStr"].ToString();
public DbHelperSQL()
{
}
#region 公用方法
public static int GetMaxID(string FieldName, string TableName)
{
string strsql = "select max(" + FieldName + ")+1 from " + TableName;
object obj = DbHelperSQL.GetSingle(strsql);
if (obj == null)
{
return 1;
}
else
{
return int.Parse(obj.ToString());
}
}
public static bool Exists(string strSql)
{
object obj = DbHelperSQL.GetSingle(strSql);
int cmdresult;
if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
{
cmdresult = 0;
}
else
{
cmdresult = int.Parse(obj.ToString());
}
if (cmdresult == 0)
{
return false;
}
else
{
return true;
}
}
/// <summary>
/// 表是否存在
/// </summary>
/// <param name="TableName"></param>
/// <returns></returns>
public stati
相关文档:
SQL SERVER临时表
也可以创建临时表。临时表与永久表相似,但临时表存储在 tempdb 中,当不再使用时会自动删除。
有本地和全局两种类型的临时表,二者在名称、可见性和可用性上均不相同。本地临时表的名称以单个数字符号 (#) 打头;
它们仅对当前的用户连接是可见的;当用户从 Microsoft? SQL Server? 2000 实例断 ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlC ......
今天一不冷静就把sqlserver数据库初始化了,在网上找了半天发现了几篇帖子,受益非浅,记录下
DB2中可以使得数据库回复到指定的时间点,SQL Server数据库的Recovery Model为full 或者Bulk copy的时候,是可以从日志来恢复数据库的。实际上日志中记录的一条一条的transact sql语句,恢复数据库的时候会redo这些sql语句。&nb ......
select case when c.colid=1 then object_name(c.id) else '' end as 表名
,c.name as 字段名
,t.name 数据类型
,c.prec as 长度 ......