コード例 #1
0
        private void butGetAdress_Click(object sender, EventArgs e)
        {
            try
            {
                using (FWait wait = new FWait(() =>
                {
                    DataTable srvsNames = SQLWorks.ExecuteQuery("SELECT * FROM Users");
                    dgvTableView.Invoke(new Action(() => dgvTableView.DataSource = srvsNames));
                }))
                    wait.ShowDialog(this);
            }
            catch (Exception ex)
            {
                DisplayStatus(ex.Message);
            }

            #region
            //tbAdress.Text = NetWorks.ServersIp(tbPcName.Text);
            //SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;


            //DataTable table = instance.GetDataSources();
            //dataGridView1.DataSource = NetWorks.GetSQLServerNames();


            //comboBox2.DataSource = table;
            // comboBox2.ValueMember = table.Columns[0].ColumnName;
            #endregion
        }
コード例 #2
0
        public FMain()
        {
            InitializeComponent();
            StartPosition = FormStartPosition.CenterScreen;

            try
            {
                string[] hardNames;
                using (FWait wait = new FWait(new Action(() =>
                {
                    hardNames = SQLWorks.getUserTablesNames();
                    cbTablesList.Items.AddRange(hardNames.Select(s => SQlToHumanTranslater.TranslateToHuman(s)).ToArray());
                })))
                {
                    wait.ShowDialog(this);
                }
                cbTablesList.SelectedIndex = 0;

                string mas = string.Join(",", AllColumnsOfTables());
            }
            catch (Exception e)
            {
                DisplayStatus(e.Message);
            }
        }