数据未在数据网格视图中显示
objWorOrder = new WorkOrderBAL();
objProperties = new OMSProperties();
objProperties.SO = txtsono.Text;
DataTable dt = objWorOrder.GetDetail(objProperties);// this is for sql database stored procedure
dgvActSG.DataSource = dt;
dgvActSG.AutoGenerateColumns = false;
int rcount = dt.Rows.Count;
if (dgvActSG.Rows.Count > 0)
{
var row = dgvActSG.Rows[0];
txtcustomer.Text = row.Cells[2].Value.ToString();
dgvActSG.CurrentCell = row.Cells[0]; //set focus to first cell in first row
}
else
{
MessageBox.Show("Invalid Number", "Error");
}
答案 0 :(得分:0)
我猜你忘了绑定你的gridview
dgvActSG.DataSource = dt;
dgvActSG.DataBind();
dgvActSG.AutoGenerateColumns = false;
int rcount = dt.Rows.Count;