String user1 = txtUsername.Text.ToString();
String pw1 = txtPassword.Text.ToString();
String StrConn = "Data Source=localhost;Initial Catalog=AppStore;Integrated Security=True";
SqlConnection conn = new SqlConnection(StrConn);
conn.Open();
SqlCommand cmdLogin = new SqlCommand("SELECT * FROM Users WHERE username='"+ user1 +"' AND password='"+ pw1 +"'" , conn);
SqlDataReader dr;
dr = cmdLogin.ExecuteReader();
if (dr.Read())
{
Label1.Text = "Success";
}
else
{
Label1.Text = "Failed";
}
dr.Close();
conn.Close();
Notice the
txtUsername.text.toString() this works but if i change it to
txtUsername.toString() it doesn't work and login will always fail...I really do not know what is the difference between these 2 ...looks like the same to me.

New Topic/Question
Reply




MultiQuote






|