Guest User

Untitled

a guest
Jul 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
  2. try
  3. {
  4. using (OdbcConnection connect = new OdbcConnection(connectionString))
  5. {
  6. connect.Open();
  7. OdbcCommand cmd = new OdbcCommand("SELECT username, password FROM receptionist", connect);
  8. OdbcDataReader reader = cmd.ExecuteReader();
  9.  
  10.  
  11.  
  12. if (username_login.Text == username && password_login.Text == password)
  13. {
  14. this.Hide();
  15. MessageBox.Show("Invalid User", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  16. this.Close();
  17. }
  18. else MessageBox.Show("Invalid User", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  19. connect.Close();
  20.  
  21.  
  22.  
  23. }
  24.  
  25.  
  26.  
  27. }
  28.  
  29. catch (OdbcException ex)
  30. {
  31. MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
  32. }
  33.  
  34. <?xml version="1.0"?>
  35. <configuration>
  36. <configSections>
  37. <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
  38. <section name="yourProjectName.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  39. </sectionGroup>
Add Comment
Please, Sign In to add comment