private void button1_Click(object sender, EventArgs e) { connection.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText = "Select * from Служител where Име='" + textBox1.Text + "' and Парола='" + textBox2.Text + "' "; OleDbDataReader reader = command.ExecuteReader(); int count = 0; while (reader.Read()) { count = count + 1; } if (count == 1) { // MessageBox.Show("Потребителското име и паролата са коректни"); HotelManagemant ht = new HotelManagemant(textBox1.Text); ht.Show(); this.Hide(); } else { MessageBox.Show(" Грешно потребителско име или парола! ", " Грешка ", MessageBoxButtons.OK, MessageBoxIcon.Error); } connection.Close(); }
public Reservation(HotelManagemant HManagemant) { InitializeComponent(); this.HM = HManagemant; connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Stanislav\\Documents\\Visual Studio 2013\\Projects\\Hotel_System\\DataBase\\HotelDB.accdb; Persist Security Info=false"; text_Number.KeyPress += new KeyPressEventHandler(text_Number_KeyPress); text_Name.KeyPress += new KeyPressEventHandler(text_Name_KeyPress); text_Surname.KeyPress += new KeyPressEventHandler(text_Surname_KeyPress); }
public ActiveReservations(HotelManagemant hotelmanagemant) { InitializeComponent(); connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Stanislav\\Documents\\Visual Studio 2013\\Projects\\Hotel_System\\DataBase\\HotelDB.accdb; Persist Security Info=false"; this.Hm = hotelmanagemant; }