Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Data.OleDb;
- namespace Filmoteka
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- this.AcceptButton = button2;
- }
- private void button2_Click(object sender, EventArgs e)
- {
- var startupPath = System.IO.Path.GetDirectoryName(
- System.Reflection.Assembly.GetEntryAssembly().Location);
- OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + startupPath + "\\baza.accdb;Jet OLEDB:Database Password = vtssa;");
- con.Open();
- OleDbCommand comm = con.CreateCommand();
- comm.CommandText = "Select ID From Korisnik Where Username = '" + textBox2.Text + "' AND Password = '" + textBox1.Text + "'";
- OleDbDataReader reader = comm.ExecuteReader();
- if (reader.HasRows)
- {
- if (textBox2.Text == "admin")
- {
- admin admin = new admin();
- admin.Show();
- this.Hide();
- }
- else
- {
- if (textBox2.Text != "Admin")
- {
- Korisnik Korisnik = new Korisnik();
- Korisnik.Show();
- this.Hide();
- }
- else MessageBox.Show("Pogrešno unet password ili username.", "Filmoteka");
- }
- }
- else MessageBox.Show("Pogrešno unet password ili username.","Filmoteka");
- con.Close();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Gost Gost = new Gost();
- Gost.Show();
- this.Hide();
- }
- }
- }
Add Comment
Please, Sign In to add comment