Page1.aspx
int Empid;
string EmployeeName;
Bton_click()----
SqlConnection constr = new SqlConnection(" Data Source=LENOVO-EF645A82;Attach DbFilename=E:\\ ERSYSTEMS_WEB_1 \\DataSourse\\E mpDb1.mdf;Initi al Catalog=Erdata; Integrated Security=True") ;
constr.Open();
string strSQL = "select * from M_Employee where Empid=('" + txtuid.Text + "')AND EmpPwd=('" + txtpwd.Text + "')";
string strSQLCOUNT = "select count (*) from M_Employee where Empid=('" + txtuid.Text + "') AND EmpPwd=('" + txtpwd.Text + "')";
SqlCommand cmdcount;
cmdcount =new SqlCommand (strSQLCOUNT ,constr );
int rownos = (int)cmdcount.E xecuteScalar();
SqlCommand cmdsqlstr = new SqlCommand(strS QL, constr);
System.Data.Sql Client.SqlDataR eader sqldr = cmdsqlstr.Execu teReader();
sqldr.NextResul t();
if (rownos > 0)
{
sqldr.Read();
while (sqldr .Read () )
{
Empid=(int)sqld r ["Empid"];
string EmployeeName = sqldr["EmpName"].ToString ();
}
Session ["usid"]=Empid.ToString ();
Session["userid"] = EmployeeName.ToString ();
Response.Redire ct("membermain. aspx" );
}
lblerror.Text = "Your User Id & Password are not Correct Plz Try Again.....";
lblerror.Visibl e = true;
constr.Close();
My Aim to get the emp name to next page...
Page2.aspx..
if (Session["userid"] == null)
{
Response.Redire ct("Default.asp x");
}
WelcomeName = Session["userid"].ToString();
}
int Empid;
string EmployeeName;
Bton_click()----
SqlConnection constr = new SqlConnection(" Data Source=LENOVO-EF645A82;Attach DbFilename=E:\\ ERSYSTEMS_WEB_1 \\DataSourse\\E mpDb1.mdf;Initi al Catalog=Erdata; Integrated Security=True") ;
constr.Open();
string strSQL = "select * from M_Employee where Empid=('" + txtuid.Text + "')AND EmpPwd=('" + txtpwd.Text + "')";
string strSQLCOUNT = "select count (*) from M_Employee where Empid=('" + txtuid.Text + "') AND EmpPwd=('" + txtpwd.Text + "')";
SqlCommand cmdcount;
cmdcount =new SqlCommand (strSQLCOUNT ,constr );
int rownos = (int)cmdcount.E xecuteScalar();
SqlCommand cmdsqlstr = new SqlCommand(strS QL, constr);
System.Data.Sql Client.SqlDataR eader sqldr = cmdsqlstr.Execu teReader();
sqldr.NextResul t();
if (rownos > 0)
{
sqldr.Read();
while (sqldr .Read () )
{
Empid=(int)sqld r ["Empid"];
string EmployeeName = sqldr["EmpName"].ToString ();
}
Session ["usid"]=Empid.ToString ();
Session["userid"] = EmployeeName.ToString ();
Response.Redire ct("membermain. aspx" );
}
lblerror.Text = "Your User Id & Password are not Correct Plz Try Again.....";
lblerror.Visibl e = true;
constr.Close();
My Aim to get the emp name to next page...
Page2.aspx..
if (Session["userid"] == null)
{
Response.Redire ct("Default.asp x");
}
WelcomeName = Session["userid"].ToString();
}
Comment