Dong Lam Trien

Dong Lam Trien

  • 833
  • 986
  • 145.7k

How the find and assignment field with DataView type ?

May 22 2018 10:12 PM
I get the employee list from SQL Server problem with fields:
ID: id employee
Employee: name employee
after filter the kernel list dv.RowFilter = "set condition unique 1 recoder" at the command if (dv.Count == 1) at this assignment id and the kernel name is not correct the unique file filter on which it assign the first file in the family list. yourself want to get sample sample already been filter by dv.RowFilter, main syntax in command if (dv.Count == 1) {// chars this again as what ?)
[code]
string tmpSQL = "string to get the list employee";
DataTable dt = Conection.FillDatatable(tmpSQL);
DataView dv = new DataView(dt);
// Search fast Employee
dv.RowFilter = "set condition unique 1 recoder";
if (dv.Count == 1)
{
//error at this buffer is not get unique sample template 
txtIdEmployee.Text = dv.Table.Rows[0]["ID"].ToString(); 
txtNameEmployee.Text = dv.Table.Rows[0]["Employee"].ToString();
}
else
{
//...
}
[/code]