SqlConnection conn = new SqlConnection(@"server=DELL-PC\SQLEXPRESS;Database=WinApp;Integrated Security = true"); SqlCommand cmd = new SqlCommand("select count(*) from LoginInfo where Username = @uname, password = @pwd",conn); cmd.Parameters.Add(new SqlParameter("@uname", lblunametxt.Text)); cmd.Parameters.Add(new SqlParameter("@pwd", lblpwdtxt.Text)); conn.Open(); int noOfRowsAffected = (int)cmd.ExecuteScalar(); conn.Close(); if(noOfRowsAffected > 0) { MDIParent md = new MDIParent(); md.Show(); this.Hide(); } else { Console.Write(" invalid credentials"); }
select count(*) from LoginInfo where Username = @uname and password = @pwd
AND
,
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)