Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

»ùÓÚSQLServerµÄÊý¾Ý·ÃÎÊ»ù´¡Àà

/// <summary>
/// Êý¾Ý·ÃÎÊ»ù´¡Àà(»ùÓÚSQLServer)
/// Copyright (C) 2008-2009 С±¿µ°
/// </summary>
public class DbHelperSQL
{
//Êý¾Ý¿âÁ¬½Ó×Ö·û´®(web.configÀ´ÅäÖÃ)
public static string connectionString = PubConstant.ConnectionString;
public DbHelperSQL()
{
}
#region ¹«Ó÷½·¨
/// <summary>
/// ÅжÏÊÇ·ñ´æÔÚij±íµÄij¸ö×Ö¶Î
/// </summary>
/// <param name="tableName">±íÃû³Æ</param>
/// <param name="columnName">ÁÐÃû³Æ</param>
/// <returns>ÊÇ·ñ´æÔÚ</returns>
public static bool ColumnExists(string tableName, string columnName)
{
string sql = "select count(1) from syscolumns where [id]=object_id('" + tableName + "') and [name]='" + columnName + "'";
object res = GetSingle(sql);
if (res == null)
{
return false;
}
return Convert.ToInt32(res) > 0;
}
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 = 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;
}


Ïà¹ØÎĵµ£º

SQLSERVER SQLÐÔÄÜÓÅ»¯

1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......

sqlserver:openrowset / oracle:table/view@dblinkÃû

Ö»ÊÇsqlserver ÌṩµÄÔ¶³ÌÊý¾Ý·ÃÎʺ¯Êý;  ÔÚ±¾µØsqlserver ÖÐÈ¡ÍⲿÊý¾ÝÔ´Êý¾Ýʱºò¿ÉÓÃ;
¶ÔÁ¬½Ó±¾µØ oracle ²Ù×÷Ô¶³Ì oracle ²»ÄÜʹÓÃ; ²âÊÔ: pl/sql ÖÐʹÓÃ:
select * from openrowset(................); ÎÞЧ!!!!!!!!!!!!!!
ÔÚoracle ÖÐÐèÒª·ÃÎÊÔ¶³ÌÊý¾Ý,ÐèÒª½¨Á¢Ò»Á¬½ÓÔ¶³Ìoracle µÄ dblink ;
ÔÙÓÃÈçÏ·½ ......

ʹÓÃSQLServerÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾ä

Èç¹ûÄã¾­³£Óöµ½ÏÂÃæµÄÎÊÌ⣬Äã¾ÍÒª¿¼ÂÇʹÓÃSQL ServerµÄÄ£°åÀ´Ð´¹æ·¶µÄSQLÓï¾äÁË£º
SQL³õѧÕß¡£
¾­³£Íü¼Ç³£ÓõÄDML»òÊÇDDL SQL Óï¾ä¡£
ÔÚ¶àÈË¿ª·¢Î¬»¤µÄSQLÖУ¬Ã¿¸öÈ˶¼ÓÐ×Ô¼ºµÄSQLÏ°¹ß£¬Ã»ÓÐÒ»Ì×ͳһµÄ¹æ·¶¡£
ÔÚSQL Server Management StudioÖУ¬ÒѾ­¸ø´ó¼ÒÌṩÁ˺ܶೣÓõÄÏÖ³ÉSQL¹æ·¶Ä£°å¡£
SQL Server Management ......

ISA·À»ðǽ¿Í»§¶ËºÍSQLSERVER¿Í»§¶ËµÄÎÊÌâ

ÓÐÍâÀ´³ÌÐò°²×°»ùÓÚ.NET FRAMEWORK 3.5µÄÓ¦ÓóÌÐòÔÚÄÚÍøµÄPCÉÏ£¬ÐèҪͨ¹ýISA·À»ðǽ¿Í»§¶Ë¾­¹ý·þÎñÆ÷ÉϵÄISA2006 SP1·ÃÎÊÍâÍøµÄSQLSERVER2005Êý¾Ý¿â¡£
        °´ÕÕÒÔÍù¾­Ñ飬ÐèÒªÅäÖÃÒ»ÌõSQLSERVER2005·þÎñÆ÷ËùÔÚµÄIPµØÖ·µÄ³öÕ¾¹æÔò£¬²¢ÇÒ²¢²»ÐèÒªÉèÖÃÒ»Ìõ»ùÓÚÓòÃûµÄ¹æÔò¡£
 &nb ......

SqlServerÓαêʾÀý

declare @areaid varchar(100)
declare @areaname varchar(100)
declare Cur cursor  for
select code as areaID,[name] as areaName  from dbo.province
open Cur
Fetch next from Cur Into @areaid,@areaname
While @@fetch_status=0   
Begin
    print('insert into ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ