Hello Friends
Today i will teach you how to design log in page in Asp.net with sql connectivity
Asp.net Coding
...........................
protected void Button1_Click(object sender, EventArgs e)
{
bool flag = false;
SqlConnection con = new SqlConnection("Data Source=NIIT-PC;Initial Catalog=School;Integrated Security=True");
con.Open();
SqlCommand com=new SqlCommand("select count (*) from Login where Username='"+TextBox1.Text+"'and password='"+TextBox2.Text+"'",con);
flag = Convert.ToBoolean(com.ExecuteScalar());
if (flag == true)
{
Response.Redirect("~/Register.aspx");
}
else
{
Label1.Text = "incorrect user name And Password";
}
con.Close();
}
SQl Coding
Create database School
create table login(username nvarchar(30),password nvarchar(30))
insert into login values('chetan','ravi');
Today i will teach you how to design log in page in Asp.net with sql connectivity
Asp.net Coding
...........................
protected void Button1_Click(object sender, EventArgs e)
{
bool flag = false;
SqlConnection con = new SqlConnection("Data Source=NIIT-PC;Initial Catalog=School;Integrated Security=True");
con.Open();
SqlCommand com=new SqlCommand("select count (*) from Login where Username='"+TextBox1.Text+"'and password='"+TextBox2.Text+"'",con);
flag = Convert.ToBoolean(com.ExecuteScalar());
if (flag == true)
{
Response.Redirect("~/Register.aspx");
}
else
{
Label1.Text = "incorrect user name And Password";
}
con.Close();
}
SQl Coding
Create database School
create table login(username nvarchar(30),password nvarchar(30))
insert into login values('chetan','ravi');

No comments:
Post a Comment