Guest User

Untitled

a guest
Feb 7th, 2016
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Data.OleDb;
  11.  
  12. namespace Filmoteka
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. this.AcceptButton = button2;
  20. }
  21. private void button2_Click(object sender, EventArgs e)
  22. {
  23. var startupPath = System.IO.Path.GetDirectoryName(
  24. System.Reflection.Assembly.GetEntryAssembly().Location);
  25. OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + startupPath + "\\baza.accdb;Jet OLEDB:Database Password = vtssa;");
  26. con.Open();
  27. OleDbCommand comm = con.CreateCommand();
  28. comm.CommandText = "Select ID From Korisnik Where Username = '" + textBox2.Text + "' AND Password = '" + textBox1.Text + "'";
  29. OleDbDataReader reader = comm.ExecuteReader();
  30. if (reader.HasRows)
  31. {
  32. if (textBox2.Text == "admin")
  33. {
  34. admin admin = new admin();
  35. admin.Show();
  36. this.Hide();
  37. }
  38. else
  39. {
  40. if (textBox2.Text != "Admin")
  41. {
  42. Korisnik Korisnik = new Korisnik();
  43. Korisnik.Show();
  44. this.Hide();
  45. }
  46. else MessageBox.Show("Pogrešno unet password ili username.", "Filmoteka");
  47.  
  48. }
  49. }
  50. else MessageBox.Show("Pogrešno unet password ili username.","Filmoteka");
  51. con.Close();
  52.  
  53. }
  54.  
  55. private void button1_Click(object sender, EventArgs e)
  56. {
  57. Gost Gost = new Gost();
  58. Gost.Show();
  59. this.Hide();
  60. }
  61. }
  62. }
Add Comment
Please, Sign In to add comment