日期:2014-05-17 浏览次数:20534 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ServerConnection sc = new ServerConnection("(local)", "sa", "123456");
sc.LoginSecure = false;
sc.Login = "sa";
sc.Password = "123456";
Console.WriteLine("DatabaseCount:" + "win");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Server s = new Server("POOFLY-PC");
ServerConnection sc = s.ConnectionContext;
sc.LoginSecure = false;
sc.Login = "sa";
sc.Password = "123456";
Database db = new Database(s, "newdb");
db.Create();
//ServerConnection sc = new ServerConnection("(local)", "sa", "123456");
//sc.LoginSecure = false;
//sc.Login = "sa";
//sc.Password = "123456";
//Console.WriteLine("DatabaseCount:" + "win");
}
}
}