C# restore database and create user
2007-01-08 11:03
197 查看
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.IO;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Runtime.InteropServices;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Text;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Data.SqlClient;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Data;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
namespace RestoreDatabase
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public class IniFile
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private string bakFileName = string.Empty;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private string bakfileNmNotExtension = string.Empty;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public string Path;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**/////声明读写INI文件的API函数
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
[DllImport("kernel32")]
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
[DllImport("kernel32")]
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//类的构造函数,传递INI文件名
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public IniFile(string inipath)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Path = inipath;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//写INI文件
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void IniWriteValue(string Section, string Key, string Value)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
WritePrivateProfileString(Section, Key, Value, this.Path);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//读取INI文件指定
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public string IniReadValue(string Section, string Key)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
StringBuilder temp = new StringBuilder(255);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
int i = GetPrivateProfileString(Section, Key, "", temp, 255, this.Path);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return temp.ToString();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public string bakFileNm
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
get ...{ return this.bakFileName; }
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
set ...{ this.bakFileName = value; }
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public string bakFileNmNotExn
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
get ...{ return this.bakfileNmNotExtension; }
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
set ...{ this.bakfileNmNotExtension = value; }
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public Boolean JudgementNotExist(string sql, string tableNm,ref SqlConnection conn, ref DataSet ds, ref SqlDataAdapter da)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ds.Tables.Clear();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
da.SelectCommand = new SqlCommand(sql,conn);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
da.Fill(ds, tableNm);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (ds.Tables[0].Rows.Count == 0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch (Exception e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{ throw e; }
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
Program.cs
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Collections.Generic;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Text;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Data.SqlClient;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Data;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Reflection;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.IO;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
namespace RestoreDatabase
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
class Program
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public static void Main(string[] args)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
string ServerName, MSSQLDB, UsrId, UsrPwd, InifilePath, SysPath, ExistDBsql, restoreSql, CreateDBSql;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
string CreateLogin, CreateUser, CreateAlter, AddRole, ExistLogins,ExistUser;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//get database info from 'database.ini' file
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
InifilePath = Environment.CurrentDirectory + "/Setup/Database/databaseInfo.ini";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
IniFile ini = new IniFile(InifilePath);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//ServerName = ini.IniReadValue("Database", "ServerName");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
MSSQLDB = ini.IniReadValue("Database", "MSSQLDB");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
UsrId = ini.IniReadValue("Database", "USRID");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
UsrPwd = ini.IniReadValue("Database", "USRPWD");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//get '.bak' file from currentDirectory
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DirectoryInfo dir = new DirectoryInfo(Environment.CurrentDirectory + "/Setup/Database/");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
foreach (FileInfo fileinfo in dir.GetFiles("*.bak"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (fileinfo.Extension == ".bak")
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ini.bakFileNm = fileinfo.Name;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ini.bakFileNmNotExn = fileinfo.Name.Replace(fileinfo.Extension, "").Trim();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SysPath = Environment.CurrentDirectory + "/Setup/Database/" + ini.bakFileNm;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ExistDBsql = "SELECT 1 FROM master..sysdatabases WHERE name='" + ini.bakFileNmNotExn + "'";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
restoreSql = "RESTORE DATABASE " + MSSQLDB + " FROM DISK='" + SysPath + "' WITH REPLACE";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CreateDBSql = "CREATE DATABASE " + MSSQLDB + " ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CreateLogin = "EXEC master.dbo.sp_addlogin @loginame = N'" + UsrId + "', @passwd = N'" + UsrPwd + "'";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//CreateLogin = "CREATE LOGIN [" + UsrId + "] WITH PASSWORD=N'" + UsrPwd + "', DEFAULT_DATABASE=[master], " +
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// "DEFAULT_LANGUAGE= [us_english], CHECK_EXPIRATION=ON, CHECK_POLICY=ON ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CreateUser = "CREATE USER [" + UsrId + "] FOR LOGIN [" + UsrId + "] ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
CreateAlter = "ALTER USER [" + UsrId + "] WITH DEFAULT_SCHEMA=[dbo] ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
AddRole = "EXEC sp_addrolemember N'db_owner', N'" + UsrId + "' ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ExistLogins = "SELECT 1 FROM master..syslogins where name='" + UsrId + "'";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
ExistUser="select * from sysusers where name='" + UsrId + "'";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SqlConnection conn = new SqlConnection("server=localhost;uid=sa;pwd=as;");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SqlCommand comm = new SqlCommand();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.Connection = conn;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
conn.Open();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
DataSet ds = new DataSet();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
SqlDataAdapter da = new SqlDataAdapter(ExistDBsql, conn);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (ini.JudgementNotExist(ExistDBsql, "sysdatabases", ref conn, ref ds, ref da))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine("Creating Database...");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.CommandText = CreateDBSql;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.ExecuteNonQuery();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine("Create Database Complete.");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine("Restoring Database...");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.CommandText = restoreSql;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.ExecuteNonQuery();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine("Restore Database Complete.");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine("Creating Database User ...");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.Connection.ChangeDatabase("master");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (ini.JudgementNotExist(ExistLogins, "sysdatabases", ref conn, ref ds, ref da))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.CommandText = CreateLogin;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.ExecuteNonQuery();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.Connection.ChangeDatabase(ini.bakFileNmNotExn);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (ini.JudgementNotExist(ExistUser, "sysdatabases", ref conn, ref ds, ref da))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.CommandText = CreateUser;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.ExecuteNonQuery();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.CommandText = CreateAlter;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.ExecuteNonQuery();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.CommandText = AddRole;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
comm.ExecuteNonQuery();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine("Create Database User Complete");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch (Exception e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine(e.ToString());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine("We are sorry for the inconvenience caused to you.");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.WriteLine("You will receive an email from us to help you find what you need.");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Console.ReadLine();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
PS:注意,因为CommadTimeOut(即等待命令执行的时间)默认为30秒,如果你的数据库足够大的话,必须重新设置该值。不然将出现TimeOut警告
相关文章推荐
- Step By Step Guide To Create Physical Standby Database Using RMAN Backup and Restore (Doc ID 469493.
- mysql create database and user 新建数据库并为其创建专用账号
- How-To create a MySQL database and set privileges to a user
- Create a SQL Server Database and User for vCenter Server
- create a first user and a first database for him in mysql
- Step By Step Guide To Create Physical Standby Database Using RMAN Backup and Restore
- csharp: SQL Server 2005 Database Backup and Restore using C#
- SQL Server Database Backup and Restore in C#
- 178.All the database users are presently connected to the database instance and working. The HR user
- How to create a new user and grant permissions on MySql
- How to restore deleted user accounts and their group memberships in Active Directory
- #2 create and populate a database && realistic and practical applications
- How to Back Up and Restore a MySQL Database
- Create Oracle Enterprise Manager repository data after restore a database from another server
- Oracle Flashback Database and Restore Points 说明
- Change Default User and Password for Cognos Content Database
- [SQL Server][FILESTREAM] -- How to Backup and Restore a SQL Server FILESTREAM Enabled Database
- Transfer postgres database to another server - backup and restore
- Practice:Demonstrating Database User Objects, Roles and Permissions
- How to create a DLL library in C and then use it with C#