private void DGV_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
switch (e.ColumnIndex)
{
case 1:
p1.cmd = new OleDbCommand("select pname from pmaster where code='" + DGV[e.ColumnIndex, e.RowIndex].Value + "'", p1.Cn);
p1.rs = p1.cmd.ExecuteReader();
if(p1.rs.Read()) DGV[e.ColumnIndex + 1, e.RowIndex].Value = p1.rs[0];
break;
case 2:
break;
default:
break;
}
}
{
switch (e.ColumnIndex)
{
case 1:
p1.cmd = new OleDbCommand("select pname from pmaster where code='" + DGV[e.ColumnIndex, e.RowIndex].Value + "'", p1.Cn);
p1.rs = p1.cmd.ExecuteReader();
if(p1.rs.Read()) DGV[e.ColumnIndex + 1, e.RowIndex].Value = p1.rs[0];
break;
case 2:
break;
default:
break;
}
}
No comments:
Post a Comment