Advertisement
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 vjezba_baza
- {
- public partial class Form1 : Form
- {
- User odabraniUser;
- public Form1()
- {
- InitializeComponent();
- }
- OleDbConnection con = new OleDbConnection("Provider=OraOLEDB.Oracle; OLEDB.NET=True; DATA SOURCE = veza1; PERSIST SECURITY INFO=True;USER ID = MHRANJ; PASSWORD = DfhI51aB461");
- string userid;
- private void LoginBtn_Click(object sender, EventArgs e)
- {
- con.Open();
- if (UsernameText.Text != "")
- {
- string querry = "select * from SHOP_USER";
- OleDbDataAdapter adapter = new OleDbDataAdapter(querry, con);
- DataTable dt = new DataTable();
- adapter.Fill(dt);
- bool pristupi = false;
- foreach (DataRow row in dt.Rows)
- {
- if (row[1].ToString() == UsernameText.Text)
- {
- userid = row[0].ToString();
- odabraniUser = new User(userid);
- pristupi = true;
- }
- }
- if (pristupi)
- {
- Form2 f2 = new Form2(odabraniUser);
- f2.Show();
- }
- else MessageBox.Show("Invalid username");
- }
- else MessageBox.Show("Input username");
- con.Close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement