我的“订单”表如下所示:
orderId CustomerName
1 customer1
2 customer2
3 customer1
4 customer1
我的代码只有一个 orderId
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();
如何使用 customer1 获取所有 orderId 1、3、4?