TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mufid Bagdadi
NA
146
24.4k
if statement c# & sql...
May 20 2016 6:45 AM
Following is my code my requirement is after if my password is rpgls007 it should redirect to particular page else to other page when data is read from database,
con.Open();
string strQuery = "select * from empData where empid = @username and password = @password";
SqlCommand cmd = new SqlCommand(strQuery);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@username", txtuser.Text.Trim());
cmd.Parameters.AddWithValue("@password", txtpassword.Text.Trim());
cmd.Connection = con;
dr = cmd.ExecuteReader();
if (dr.Read())
{
if (txtpassword.Text != "rpgls007")
{
Session["user"] = txtuser.Text;
Response.Redirect("
user/user.aspx
");
}
else
{
Session["user"] = txtuser.Text;
Response.Redirect("
user/password.aspx
");
}
}
else
{
lbl_msg.Text = "Incorrect User or Password";
resetPassword.Visible = true;
lbl_msg.Visible = true;
}
Reply
Answers (
5
)
how to print 20 records in a page using crystal reports
Publish RemoteApp through Powershell Script in C#