Exemple #1
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            string cnnStr = $"Data Source={MyConfig.RootServerName};" +
                            $"Initial Catalog={MyConfig.DatabaseName};" +
                            $"Integrated Security=True";

            try
            {
                UtilDB.BdsDSPM.DataSource = UtilDB.ExecSqlDataTable($"SELECT * FROM {MyConfig.ViewDSPMName}  ORDER BY {MyConfig.DisplayMemberDSPM}", cnnStr);
                if (UtilDB.BdsDSPM.DataSource == null)
                {
                    Close();
                    return;
                }

                cboChiNhanh.DataSource    = UtilDB.BdsDSPM;
                cboChiNhanh.DisplayMember = MyConfig.DisplayMemberDSPM;
                cboChiNhanh.ValueMember   = MyConfig.ValueMemberDSPM;

                cboChiNhanh.SelectedIndex = -1;
                cboChiNhanh.SelectedIndex = 0;
            }
            catch (SqlException ex)
            {
                UtilDB.ShowError(ex);
            }
            txtTK.Select();
        }