SqlConnection con = new SqlConnection("Data Source=GITTWO-PC\\sql2008R2;Initial Catalog=Application;Integrated Security=SSPI"); con.Open(); SqlCommand cmd = new SqlCommand("validateuser", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@username", textBox1.Text); cmd.Parameters.AddWithValue("@password", textBox2.Text); cmd.Parameters.Add("@result", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); int result = int.Parse(cmd.Parameters["@result"].Value.ToString()); if (result == 1) { Form2 frm = new Form2(); frm.Show(); } else if (result == 2) { //MessageBox.Show("Invalid Password", "Invalid Password"); label3.Visible = true; label3.Text = "Invalid Password.......!!!"; } else if (result == 3) { //MessageBox.Show("Invalid User Name", "Invalid User Name"); label3.Text = "Invalid UserName.......!!!"; } else if (result == 4) { //MessageBox.Show("Invalid User Name & Password", "Invalid User Name & Password"); label3.Text = "Invalid UserName and Password.......!!!"; } con.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)