When I run the ide show the following exception
System.Data.SqlClient.SqlException: 'Incorrect syntax near '='.'
string query = "SELECT * FROM lwpos_categories WHERE parent_id=" + ddlCategory.SelectedValue;
When I run the ide show the following exception
System.Data.SqlClient.SqlException: 'Incorrect syntax near '='.'
string query = "SELECT * FROM lwpos_categories WHERE parent_id=" + ddlCategory.SelectedValue;
Probably ddlCategory.SelectedValue
is empty. The following can fix this exception (and I recommend using SqlParameters
).
string query = "SELECT * FROM lwpos_categories WHERE parent_id= '" + ddlCategory.SelectedValue + "'";