/// <summary>
        /// 数据库名下拉框下拉时,远程获取所有数据库名
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DSDBCB_DropDownOpened(object sender, EventArgs e)
        {
            if (this.SelectedItem == null)
            {
                return;
            }
            if (!(this.SelectedItem is DesignerDataBaseDataSource))
            {
                return;
            }
            DesignerDataBaseDataSource ds = SelectedItem as DesignerDataBaseDataSource;

            if (!string.IsNullOrEmpty(ds.Address) && !string.IsNullOrEmpty(ds.UserName) && !string.IsNullOrEmpty(ds.PassWord))
            {
                string constr = string.Format("Server={0};database={1};uid={2};pwd={3}", ds.Address, "master", ds.UserName, ds.PassWord);
                using (SqlExcuter se = new SqlExcuter(DataBaseType.SqlServer, constr))
                {
                    DataTable data = se.ExecuteSelectSql("select name from master..sysdatabases");
                    DSDBCB.Items.Clear();
                    foreach (DataRow r in data.Rows)
                    {
                        string n = r["name"].ToString();
                        DSDBCB.Items.Add(n);
                    }
                }
            }
            else
            {
                MessageBox.Show("请输入完整信息");
            }
        }
 /// <summary>
 /// 使用Indusfo.DAL 返回DataTable
 /// </summary>
 /// <param name="designerDataBaseDataSource"></param>
 /// <returns></returns>
 private static Task <DataTable> ExcuteDataBaseDataSource(DesignerDataBaseDataSource ds)
 {
     return(Task <DataTable> .Run(() =>
     {
         using (SqlExcuter se = new SqlExcuter(DataBaseType.SqlServer, ds.ConnectionString))
         {
             return se.ExecuteSelectSql(ds.SqlString);
         }
     }));
 }
 private void DataViewButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (SqlExcuter se = new SqlExcuter(DataBaseType.SqlServer, (this.SelectedItem as DesignerDataBaseDataSource).ConnectionString))
         {
             DataTable data             = se.ExecuteSelectSql((this.SelectedItem as DesignerDataBaseDataSource).SqlString);
             DataTablePreViewWindow win = new DataTablePreViewWindow();
             win.Grid.ItemsSource = data.DefaultView;
             win.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void TestConnectionButton_Click(object sender, RoutedEventArgs e)
 {
     if (this.SelectedItem == null)
     {
         return;
     }
     if (this.SelectedItem is DesignerDataBaseDataSource)
     {
         using (SqlExcuter se = new SqlExcuter(DataBaseType.SqlServer, (this.SelectedItem as DesignerDataBaseDataSource).ConnectionString))
         {
             DataTable data = se.ExecuteSelectSql("select 1");
             if (data == null)
             {
                 MessageBox.Show("连接失败");
             }
             else
             {
                 MessageBox.Show("连接成功");
             }
         }
     }
 }