0
多行我有我的「訂單」表如下所示:選擇具有相同的ID
orderId CustomerName
1 customer1
2 customer2
3 customer1
4 customer1
,我有我的代碼只能獲得一個訂單ID
SqlCommand command = new SqlCommand("SELECT orderId FROM orders WHERE CustomerName='"+name+"'", connection);
SqlDataReader reader = command.ExecuteReader();
if (reader.Read()){
MyOrders order1 = new MyOrders(reader.GetInt32(0));
orders.Add(order1);
}
return orders.ToArray();
如何讓所有的orderId 1, 3,4與customer1?