Пример #1
0
        public void CreateDataBase()
        {
            var connParam = new ConnectionParam("master", Connection.SqlConnection.DataSource, Connection.UserName, Connection.Password);
              var connection = Connection.Instance;

            connection.Connect(connParam);
        }
Пример #2
0
        public static string GetConnectionString(ConnectionParam param)
        {
            var strSql = new SqlConnectionStringBuilder();

            strSql.DataSource = param.ServerName;
            strSql.UserID = param.UserName;
            strSql.Password = param.Password;
            strSql.InitialCatalog = param.DataBaseName;

            return strSql.ToString();
        }
Пример #3
0
 public void Connect(ConnectionParam param)
 {
     this.DataBaseName = param.DataBaseName;
     this.UserName = param.UserName;
     this.Password = param.Password;
     this.SqlConnection.ConnectionString = GetConnectionString(param);
     this.SqlConnection.Open();
 }