using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Login_Form
public partial class Form1 : Form
public Form1()
InitializeComponent();
private void label1_Click(object sender, EventArgs e)
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
}
private void btCancel_Click(object sender, EventArgs e)
Close();
private void btLogin_Click(object sender, EventArgs e)
MY_DB db = new MY_DB();
SqlDataAdapter adapter = new SqlDataAdapter();
DataTable table = new DataTable();
SqlCommand command = new SqlCommand("SELECT * FROM LOG_IN WHERE USERNAME =@Y
user AND password = @Pass", db.getConnection);
command.Parameters.Add("@User", SqlDbType.VarChar).Value = TextBoxUserName.Text;
command.Parameters.Add("@Pass", SqlDbType.VarChar).Value = TextBoxPassword.Text;
adapter.SelectCommand = command;
adapter.Fill(table);
if ((table.Rows.Count > 0 ))
this.DialogResult = DialogResult.OK;
else
MessageBox.Show("Invalid Username Or Password", "Login Erreor", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
private void Form1_Load(object sender, EventArgs e)
pictureBox1.Image = Image.FromFile("1495165872455_600.jpg");