public frmConfig() { me = this; InitializeComponent(); try { SqlConnection sc = new SqlConnection("Data Source=DESKTOP-UR6D0PD\\SQLEXPRESS;Initial Catalog=QuanLyNhanSu;Integrated Security=True"); sc.Open(); SqlCommand scmd = new SqlCommand("select * from sysservers", sc); SqlDataReader sdr = scmd.ExecuteReader(); if (sdr.HasRows) { while (sdr.Read()) { RadComboBoxItem cmbi = new RadComboBoxItem(); cmbi.Value = sdr.GetValue(2).ToString().Trim(); cmbi.Text = sdr.GetValue(2).ToString().Trim(); cmbServer.Items.Add(cmbi); } } RadComboBoxItem cmbi1 = new RadComboBoxItem(); cmbi1.Text = "Window Authentication"; cmbi1.Value = "."; cmbServer.Items.Add(cmbi1); sc.Close(); } catch { } this.cmbServer.SelectedIndex = 0; }
private void frmMain_Load(object sender, EventArgs e) { frmConfig obj = new frmConfig(); obj.ShowDialog(); //DateTime.Parse(layngay()); //MessageBox.Show(layngay()); }