±¸·ÝºÍ»¹ÔSQL Server¼°Ñ¹ËõAccessÊý¾Ý¿â
*
* ¹¦ÄÜ˵Ã÷:±¸·ÝºÍ»Ö¸´SQL ServerÊý¾Ý¿â
* ×÷Õß: Áõ¹¦Ñ«;
* °æ±¾:V0.1(C#2.0);ʱ¼ä:2007-1-1
* µ±Ê¹ÓÃSQL Serverʱ,ÇëÒýÓà COM×é¼þÖеÄ,SQLDMO.dll×é¼þ
* µ±Ê¹ÓÃAccessÖÐ,Çëä¯ÀÀÌí¼ÓÒýÓÃÒÔÏÂÁ½¸ödll
* ÒýÓÃC:/Program Files/Common Files/System/ado/msadox.dll,¸ÃDLL°üº¬ADOXÃüÃû¿Õ¼ä
* ÒýÓÃC:/Program Files/Common Files/System/ado/msjro.dll,¸ÃDLL°üº¬JROÃüÃû¿Õ¼ä
* *******************************************************************************/
using System;
using System.Data;
using System.Configuration;
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.IO;
using ADOX;//¸ÃÃüÃû¿Õ¼ä°üº¬´´½¨ACCESSµÄÀà(·½·¨)--½â¾ö·½°¸ ==> ÒýÓà ==> Ìí¼ÓÒýÓà ==> ÓÎÀÀÕÒµ½.dll
using JRO;//¸ÃÃüÃû¿Õ¼ä°üº¬Ñ¹ËõACCESSµÄÀà(·½·¨)
namespace EC
{
/// <summary>
/// Êý¾Ý¿â»Ö¸´ºÍ±¸·Ý
/// </summary>
public class SqlBackObject
{
public SqlBackObject()
{
//
// TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼
//
}
#region SQLÊý¾Ý¿â±¸·Ý
/// <summary>
/// SQLÊý¾Ý¿â±¸·Ý
/// </summary>
/// <param name="ServerIP">SQL·þÎñÆ÷IP»ò(Localhost)</param>
 
Ïà¹ØÎĵµ£º
Õû¸öSQLºÍAsp.net(vb.net)Ò»Æð´ò°üµÄÈ«¹ý³ÌдһÏ¡£
Ò».×¼±¸±ØÒªµÄÎļþ
1. SQL½Å±¾Îļþ£¬Éú³ÉÒÔºó°²×°¹ý³ÌÖÐÐèÒªµÄ±íºÍ´æ´¢¹ý³ÌµÈµÈ£»
Éú³ÉÖ®ºó£¬¾ÍÔÝʱ°ÑËüÃüÃûΪdb.sql(×¢Òâ´óСд)
2.LisenceFile.rtfµÄ°²×°Îļþ£¬ÒòΪÎÒµÄϵͳÊǸöÈ˵ģ¬¶øÇÒfreeµÄ£¬ËùÒÔ¾ÍûÓÐ×ö¡£Õâ¸öÒÔºóÒ²ÊÇÒªÓõ½µÄ¡£
¶þ.ÔÚ×Ô¼ºÏÖÓеÄÏîÄ¿Àïà ......
---Ò»¸öÔµĵÚÒ»Ìì
SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
--- ±¾ÖܵÄÐÇÆÚÒ»
SELECT DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
---Ò»ÄêµÄµÚÒ»Ìì
SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
----¼¾¶ÈµÄµÚÒ»Ìì
SELECT DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)
----ÉϸöÔµÄ×îºóÒ»Ìì
......
---·µ»Ø±í´ïʽÖÐÖ¸¶¨×Ö·ûµÄ¿ªÊ¼Î»ÖÃ
select charindex('c','abcdefg',1)
---Á½¸ö×Ö·ûµÄÖµÖ®²î
select difference('bet','bit')
---×Ö·û×î×ó²àÖ¸¶¨ÊýÄ¿
select left('abcdef',3)
---·µ»Ø×Ö·ûÊý
select len('abcdefg')
--ת»»ÎªÐ¡×Ö·û
select lower('ABCDEFG')
--È¥×ó¿Õ¸ñºó
select ltrim(' &nbs ......
--´´½¨±íTongXunLu
CREATE TABLE TongXunLu
(
[tName] nvarchar(30),
[tAddress] nvarchar(50),
[tEmail] varchar(50)
)
--´´½¨±í students
CREATE TABLE students
(
[sId] int IDENTITY (1, 1) primary key NOT NULL ,
[sName] varchar (50) NOT ......
ÓйطÖÒ³ SQL µÄ×ÊÁϺܶ࣬ÓеÄʹÓô洢¹ý³Ì£¬ÓеÄʹÓÃÓαꡣ±¾È˲»Ï²»¶Ê¹ÓÃÓα꣬ÎÒ¾õµÃËüºÄ×Ê¡¢Ð§Âʵͣ»Ê¹Óô洢¹ý³ÌÊǸö²»´íµÄÑ¡Ôñ£¬ÒòΪ´æ´¢¹ý³ÌÊǾ¹ýÔ¤±àÒëµÄ£¬Ö´ÐÐЧÂʸߣ¬Ò²¸üÁé»î¡£ÏÈ¿´¿´µ¥Ìõ SQL Óï¾äµÄ·ÖÒ³ SQL °É¡£
·½·¨1£º
ÊÊÓÃÓÚ SQL Server 2000/2005
SELECT TOP Ò³´óС *
from tab ......