Click here to Skip to main content
16,012,223 members

Comments by Member 13432601 (Top 8 by date)

Member 13432601 3-Oct-17 1:59am View    
Lol
Member 13432601 29-Sep-17 8:37am View    
//this is my code in loginpage
SqlConnection conn = new SqlConnection(cs);
conn.Open();
SqlCommand cm = new SqlCommand("Select count(*) from tbl_User where Username='" + txtbox_UN.Text + "'", conn);
int temp = Convert.ToInt32(cm.ExecuteScalar().ToString());

if (temp == 1)
{
SqlConnection con = new SqlConnection(cs);
con.Open();
SqlCommand cmd = new SqlCommand("Select Password from tbl_User where Username='" + txtbox_UN.Text + "'", con);
string password = cmd.ExecuteScalar().ToString();
if (password == txtbox_PW.Text)
{
Session["New"] = txtbox_UN.Text;
Response.Write("Password is Correct");
Response.Redirect("Session.aspx");
}
else
{
Response.Write("Password is Incorrect");
}
}

else
{
Response.Write("Username is invalid");
}
Member 13432601 29-Sep-17 8:13am View    
Deleted
//this is my code in loginpage
SqlConnection conn = new SqlConnection(cs);
conn.Open();
SqlCommand cm = new SqlCommand("Select count(*) from tbl_User where Username='" + txtbox_UN.Text + "'", conn);
int temp = Convert.ToInt32(cm.ExecuteScalar().ToString());

if (temp == 1)
{
SqlConnection con = new SqlConnection(cs);
con.Open();
SqlCommand cmd = new SqlCommand("Select Password from tbl_User where Username='" + txtbox_UN.Text + "'", con);
string password = cmd.ExecuteScalar().ToString();
if (password == txtbox_PW.Text)
{
Session["New"] = txtbox_UN.Text;
Response.Write("Password is Correct");
Response.Redirect("Session.aspx");
}
else
{
Response.Write("Password is Incorrect");
}
}

else
{
Response.Write("Username is invalid");
}
Member 13432601 29-Sep-17 5:54am View    
Wait i will make a page where the user can login
Member 13432601 28-Sep-17 20:05pm View    
I have 3 tables in my database tbl_User, tbl_Category, tbl_NewsArticles
I used session to open the account of user.