1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;
public partial class Accueil : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=WIN-CI5C30342SF\\SQLEXPRESS; database=Admi_BDD;Integrated Security=SSPI");
try
{
con.Open();
// Label1.Visible = true;
// Label1.Text = "Etat de la connexion en ce moment :" + con.State;
}
catch (Exception exp)
{ Label1.Visible = true;
Label1.Text = "L'erreur suivante a été rencontrée: " + exp.Message; }
String cmdstr = "select count(*) from Admi_BDD where USERNAME = '" + this.TextBoxNU.Text + "'";
SqlCommand checkuser = new SqlCommand(cmdstr, con);
int temp = Convert.ToInt32(checkuser.ExecuteScalar().ToString());
if (temp==1)
{
string cmdstr2 = "select PASSWRD from Admi_BDD where USERNAME='" + this.TextBoxNU.Text + "'";
SqlCommand pass = new SqlCommand(cmdstr2, con);
string password = pass.ExecuteScalar().ToString();
if (password == TextBoxMDP.Text)
{
Session["New"] = TextBoxNU.Text;
Response.Redirect("Gestion_FII.aspx");
}
else {
Label1.Visible = true;
Label1.Text = "Mot de passe incorrect..!!";}}
}
} |
Partager