ASP.NETÔ¶³Ì±¸·Ý»Ö¸´SQL ServerÊý¾Ý¿â
///<summary>
///±¸·ÝÊý¾Ý¿âµ½±¾µØ´ÅÅÌ
///</summary>
public bool BackUp(string BackUpFile)
{
try
{
//µÚÒ»²½£ºÔÚ·þÎñÆ÷ÉÏ´´½¨ÁÙʱÎļþ¼Ð
ExecuteSql(@"master..xp_cmdshell 'md C:\temp'");
ExecuteSql(@"master..xp_cmdshell 'del C:\temp\*.* /q'");
//µÚ¶þ²½£º±¸·ÝÊý¾Ý¿âµ½·þÎñÆ÷Ŀ¼
ExecuteSql(@"backup database " + DataBaseName() + @" to disk='C:\temp\HSSY'");
//µÚÈý²½£º¹²Ïí·þÎñÆ÷µÄ±¸·ÝĿ¼
ExecuteSql(@"master..xp_cmdshell 'net share SQLDATABACK=C:\temp'");
//µÚËIJ½£º¸´ÖÆ·þÎñÆ÷Éϵı¸·ÝÎļþµ½±¾µØ
File.Copy(@"\\" + ServerIP() + @"\SQLDATABACK\HSSY", BackUpFile,true);
return true;
}
catch (System.Data.SqlClient.SqlException E)
{
throw new Exception(E.Message);
}
Ïà¹ØÎĵµ£º
ÌõÐÎÂëÊÇÆù½ñΪֹ×á¢ÊµÓõÄÒ»ÖÖ×Ô¶¯Ê¶±ð¼¼Êõ¡£ÌõÐÎÂë¼¼Êõ¾ßÓÐÒÔϼ¸¸ö·½ÃæµÄÓŵã
¡¡¡¡A£®ÊäÈëËٶȿ죺Óë¼üÅÌÊäÈëÏà±È£¬ÌõÐÎÂëÊäÈëµÄËÙ¶ÈÊǼüÅÌÊäÈëµÄ5±¶£¬²¢ÇÒÄÜʵÏÖ“¼´Ê±Êý¾ÝÊäÈ딡£
¡¡¡¡B£®¿É¿¿ÐԸߣº¼üÅÌÊäÈëÊý¾Ý³ö´íÂÊΪÈý°Ù·ÖÖ®Ò»£¬ÀûÓùâѧ×Ö·ûʶ±ð¼¼Êõ³ö´íÂÊΪÍò·ÖÖ®Ò»£¬¶ø²ÉÓÃÌõÐÎÂë¼¼ÊõÎóÂëÂʵ ......
sql server·Ö²¼Ê½ÊÂÎñ½â¾ö·½°¸
ÊÊÓû·¾³
²Ù×÷ϵͳ£ºwindows 2003
Êý¾Ý¿â£ºsql server 2000/sql server 2005
ʹÓÃÁ´½Ó·þÎñÆ÷½øÐÐÔ¶³ÌÊý¾Ý¿â·ÃÎʵÄÇé¿ö
Ò»¡¢ ÎÊÌâÏÖÏó
ÔÚÖ´Ðзֲ¼Ê½ÊÂÎñʱ£¬ÔÚsql server 2005ÏÂÊÕµ½ÈçÏ´íÎó£º
ÏûÏ¢ 7391£¬¼¶±ð 16£¬×´Ì¬ 2£¬¹ý³Ì xxxxx£¬µÚ 16 ÐÐ
ÎÞ·¨Ö´ÐиòÙ×÷£¬ÒòΪÁ´½Ó·þÎñ ......
C# SQLÊý¾Ý¿â²Ù×÷ͨÓÃÀà
using System;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
namespace Framework.DataBase
{
///
/// ͨÓÃÊý¾Ý¿âÀà
///
public class DataBase
{
private string ConnStr = null;
public DataBase()
{
&nb ......
ÍâÁ¬½ÓÈ¡Êý¾ÝÈç¹ûΪ¿Õ£¬²»´æÔÚASʱ¿ÉÄÜÈ¡µ½Êý¾Ý£¬µ«¼ÓÁËAS¾Í»á±¨´í¡£±ÈÈçSelect Top 10 a.*,b.Class AS ClassId
,b.DeviceName from AuxBusInfo a Left Join DeviceCandidate b On a.InitialDeviceRscId = b.DeviceRscId Order By AuxBusId£¬µ± ......
Õ⼸ÌìÓÃÁËÒ»ÏÂMicrosoft SQL Server 200µÄ·ÖÎö·þÎñ£¬Ìù³öÀ´¸ø´ó¼Ò·ÖÏíһϡ£
Çë¶à¶àÖ¸Õý¡£Ð»Ð»¡£
Ò»¡¢ÐèÇó£º
½¨Á¢Ò»¸öͼÊ鶩µ¥Í³¼Æϵͳ
1¡¢Í³¼Æ¸÷¸öͼÊé¹Ý¶©µ¥ÊýÁ¿¡£
2¡¢Í³¼Æ¸÷¸öͼÊé¹Ý¶©µ¥µÄ¸÷¸ö״̬µÄÊýÁ¿Õ¼¸ÃͼÊé¹ÝµÄ¶©µ¥ÊýÁ¿µÄ°Ù·Ö±È¡£
3¡¢Í¬Ê±Í³¼ÆÔʼÊýÁ¿ºÍ´¢ÔËÊýÁ¿
¶þ¡¢Êý¾Ý±í
Ö ......