//Provider=SQLOLEDB.1;
string strcon = "Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=gmhwrya;
Data Source=DELL-PC\\YAHIASQL";
SqlConnection con = new SqlConnection(strcon );
//Open Connection
con.Open();
SqlCommand scm = new SqlCommand();
scm.Connection = con;
// Command Type -->Stored Procedure
scm.CommandType = CommandType.StoredProcedure;
//Name Of Stored Procedure "log_user"
scm.CommandText = "log_user";
scm.Parameters.AddWithValue("@user_name", textBox1.Text);
scm.Parameters.AddWithValue("@Password", textBox2.Text);
int result = int .Parse (scm.ExecuteScalar().ToString());
if (result == 1)
{
MessageBox.Show("تم الدخول بنجاح");
}
else
{
MessageBox.Show("Error ");
}

No comments:
Post a Comment