private void button1_Click(object sender, EventArgs e) { String s1 = textBox1.Text; String s2 = textBox2.Text; SqlConnection cnn = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=register;Integrated Security=True"); String sql = ("select Userid,Password from reg where Userid='" + s1 + "' and Password='" + s2 + "' "); cnn.Open(); String userid=""; String password=""; SqlCommand cmd = new SqlCommand(sql,cnn); SqlDataReader reader = cmd.ExecuteReader(); if (reader.HasRows) { while(reader.Read()) { userid = reader.GetString(0); password = reader.GetString(1); Console.WriteLine(userid); Console.WriteLine(password); } if((s1.Equals(userid)) && (s2.Equals(password))) { MessageBox.Show("LOGIN SUCCESSFULLY DONE>>"); } else { MessageBox.Show("LOGIN UNSUCCESSFUL ...."); } }
Server=myServerAddress;Database=myDataBase;User Id=myUsername; Password=myPassword;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)