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.SqlClient; namespace WindowsFormsApplication3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection (@"Data Source=LEAPTHOUGHT\SQLEXPRESS;Initial Catalog=master;Integrated Security=True"); SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) from Login where UserName = ''+textBox1.Text + '' and Password= ''+ textBox2.Text +'' ",conn); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { this.Hide(); Form2 form2 = new Form2(); form2.ShowDialog(); } else { MessageBox.Show("Please check your login credentials"); } } private void button1_Click(object sender, EventArgs e) { this.Close(); } } }
SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) from Login where UserName = '"+textBox1.Text + "' and Password= '"+ textBox2.Text +"' ",conn);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)