narasiman rao
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Drawing; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection("Data Source=MOORTHY;Initial Catalog=master;Integrated Security=True "); protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(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 Login ID and Password"; Label3.ForeColor = System.Drawing.Color.DarkGreen; //Server.Transfer("default2.aspx"); } else { Label3.Text = "Login ID Does Not Match"; Label3.ForeColor = System.Drawing.Color.DarkOrange; } } protected void Button2_Click(object sender, EventArgs e) { txt_username.Text = ""; txt_password.Text = ""; Label3.Text = ""; } }
then i design the next page design as follows; Firstname textbox1Lastname textbox2 when i click the login page it goes to next page in that page Firstname ram (value from the login table to be retrieve)Lastname sam (value from the login table to be retrieve)