I am attempting to query my database and return productID's based on the orderID. First I tried:
"SELECT productID FROM `Order` WHERE Order.orderID = Order.orderID"
But that returned all the productID's from all orders in the table. I currently have the following code but now the list box isn't returning any value.
public static bool orderVerify(DropDownList ddlProductID)
MySqlConnection connection = new MySqlConnection("server=*****;user id=****;database=***;password=***;persistsecurityinfo=True");
var cmd = new MySqlCommand("SELECT productID FROM `Order` WHERE orderID = 'orderID.Text'", connection);
var reader = cmd.ExecuteReader();
DataTable dt = new DataTable();
ddlProductID.DataSource = dt;
ddlProductID.DataValueField = "productID";
ddlProductID.DataTextField = "productID";