【发布时间】:2017-11-20 05:19:17
【问题描述】:
我正在试图弄清楚如何从 sql server 发送两个项目(在一列内向上和向下)。
这是我现有的代码:
SqlDataAdapter sda = new SqlDataAdapter(" SELECT name,Subname,Code,Price from Customers", con);
DataTable dt = new DataTable();
sda.Fill(dt);
AppointmentGrid.Rows.Clear();
foreach (DataRow item in dt.Rows)
{
int n = AppointmentGrid.Rows.Add();
AppointmentGrid.Rows[n].Cells[0].Value = item[0].ToString();
AppointmentGrid.Rows[n].Cells[1].Value = item[1].ToString();
AppointmentGrid.Rows[n].Cells[2].Value = item[2].ToString();
AppointmentGrid.Rows[n].Cells[3].Value = item[3].ToString();
}
我需要将“名称”和“子名称”放在我的 datagridview 的一列中。
【问题讨论】:
标签: c#