Hi all.
i have a trouble of my testing project. could anyone can guide me to solve the problem. million thanks~~ newbie of programming.
error : System.Data.SqlClient.SqlException: 'Incorrect syntax near 'card'.'
string connectionstring = ConfigurationManager.ConnectionStrings["library2ConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(connectionstring);
con.Open();
string sql = "Select librarycardid, password" +
"from library card information" +
"where librarycardid = '" + librarycardid + "'" +
"and password = '" + password + "' ";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader reader = cmd.ExecuteReader(); <<<<<<error at here
if (reader.HasRows)
{
Label3.Text = " login success";
} else {
Label3.Text = "login fail";
}
con.Close();