internal void check(string name,ref string result)
{
object pass;
SqlConnection con = new SqlConnection("Data Source=SAMSUNG;Initial Catalog=AL_Nayesh_Kids_Castle;Persist Security Info=True;User ID=sa;Password=259695");
con.Open();
SqlCommand cmd = new SqlCommand("select * from register", con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (name == dr[0].ToString())
{
pass = dr[1];
result = Convert.ToString(pass);
break;
}
}
dr.Close();
con.Close();
}
static void Main(string[] args)
{ string result, password;
register obj = new register();
obj.student();
Console.WriteLine("name:");
string name = Console.ReadLine();
Console.WriteLine("password");
password = Console.ReadLine();
obj.check(name,ref result);
if(password==result)
Console.WriteLine("welcome");
}