I'am having a hard time with C# ATM...
Its about this nasty piece of code here:
foreach (DataGridViewRow r in dgv_selectedOrders.Rows)
{
MessageBox.Show(r.Cells[0].Value.ToString());
order_id = r.Cells[0].Value.ToString();
query = "SELECT count(orders.id) AS total_orders FROM orders WHERE customer_id = (SELECT customer_id FROM orders WHERE id = " + order_id + ");";
command = new MySqlCommand(query, conn);
MySqlDataReader sda = command.ExecuteReader();
while (sda.Read())
dgv_selectedOrders[11,r.Index].Value = sda.GetInt32(0).ToString();*/
}
This loop is going through only twice and then it stops...
Interesting is, that when I uncomment everything execpt the "MessageBox" it nicely loops through each row and it displays every "order_id" of my DataGridView.
What it should do is:
Loop through existing DataGridView and get the "Order_id" from each row. Then I want to count how many orders are already made by the customer and append the result in coulmn 11 of the DataGridView...
Any ideas?
As I said, it stops after the second row ...