lOGIN CODE

Sabarimahesh
Posted by Sabarimahesh under C# category on | Points: 40 | Views : 1456
public partial class _Default : System.Web.UI.Page 
{


string n,p;

SqlConnection con =new SqlConnection("UR CONNECTION");

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.ViewState["count"] = 0;
}
}
public void m1()

{


con.Open();
SqlCommand com = new SqlCommand("select*from kum where userid='" + TextBox1.Text + "'", con);
SqlDataReader dr;
dr = com.ExecuteReader();
while (dr.Read())
{
n = dr[0].ToString();
p = dr[1].ToString();
}
dr.Close();
if (TextBox1.Text == n && TextBox2.Text == p)
{
Label3.Text = "Valid";
}
else
{
Label3.Text = "invalid";
}



con.Close();

}




protected void Button1_Click(object sender, EventArgs e)

{
int i = int.Parse(this.ViewState["count"].ToString())+1;
this.ViewState["count"] = i;

if (i <= 3)
{


m1();
}

else
{
Label4.Text = "no";
}


}


}




{
for (i = 0; i < 2; i++)
{

m1();


}

}
else
{
Label3.Text = "no";
}
}
}

Comments or Responses

Posted by: Self-Innovator on: 4/5/2012 Level:Bronze | Status: [Member] | Points: 10
The above Code NOT wrking..Pls chk Code before posting..
Posted by: Sabarimahesh on: 4/10/2012 Level:Bronze | Status: [Member] | Points: 10
public partial class _Default : System.Web.UI.Page 


{
string n,p;
SqlConnection con =new SqlConnection("UR CONNECTION");
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)

{

this.ViewState["count"] = 0;
}
}
public void m1()
{
con.Open();
SqlCommand com = new SqlCommand("select*from kum where userid='" + TextBox1.Text + "'", con);
SqlDataReader dr;
dr = com.ExecuteReader();
while (dr.Read())
{
n = dr[0].ToString();
p = dr[1].ToString();
}
dr.Close();
if (TextBox1.Text == n && TextBox2.Text == p)
{
Label3.Text = "Valid";
}

else
{
Label3.Text = "invalid";
}

con.Close();

}

protected void Button1_Click(object sender, EventArgs e)
{
int i = int.Parse(this.ViewState["count"].ToString())+1;
this.ViewState["count"] = i;

if (i <= 3)
{
for (i = 0; i < 2; i++)
{
m1();
}
}

else
{
Label4.Text = "no";
}

}
}

Posted by: Sabarimahesh on: 4/10/2012 Level:Bronze | Status: [Member] | Points: 10
Self-Innovator

pLEASE cHECK tHE aBOVE cODE...

Login to post response