from the database value to be fetched and placed in tothe another page
first i create database fields as follows Login Id,Firstnmae,Lastnmae and password
values as follows 1,ram,sam,123 etc table name entry.
First Design page as follows;
Username txt_username(textbox)
Password txt_password (textbox)
Insert (button) CLear(button)
when i type username and password values from the entry table such as login id 1 and password from the entry table and click the insert button it shows the message valid loginid and password.when i type wrong username and password it shows the message invalid loginid and password.
Second Design page as follows
Firstname txt_firstname(textbox)
Lastname txt_lastname(textbox)
when i click the insert buton from the first desing page it goes to second design page and output as
in that page i want the output as
Firstname ram
Lastname sam
From the entry table(database).
for the oupput how to write the code and in which page code has to be write please mention.it will be great useful for me.
First design page code as follows;
protected void Button1_Click1(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select LoginID,Password from entry where LoginID = '" + txt_username.Text + "' and Password = '" + txt_password.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
Session["LoginID"] = txt_username.Text;
dr.Close();
con.Close();
Label3.Text = "Valid loginid and password";
Label3.ForeColor = System.Drawing.Color.DarkRed;
Server.Transfer("default2.aspx");
}
else
{
Label3.Text = "Invalid loginid and password";
Label3.ForeColor = System.Drawing.Color.DarkGreen;
}
}
Please help me.