vb.net - Count data displayed on my datagridview with category -


I'm having trouble with the datas using the range on my data grid view, when I used the "department" The data on the same category filtered my dataset But let me tell you how many employees, supervisors and managers are involved in that category. I want this to be displayed in my text box, i.e. txtStaff, tstManagers, txtSups Thank you!

This is my current code:

  New ODDB. Try DimCouf as ODDI Connection ("PROVIDER = Microsoft.ACE.OLEDB.12.0. Data Source =. \ Database \ IRMG TO.accdb") conF.Open () Dim query string as query = " Employee_Name, P_Level, Position_Title, Department, Team, Subteam1, Subteam2, Immediate_Head, CAREER_BAND, tblEmployees Where ("Select & amp; CAREER_ZONE; txtFilterType .text & amp;" like '%' & amp; txtFilter.Text & amp; "% ')" Dim order New OleDb.OleDbCommand (query, conference) Dim adapter New OleDb.OleDbDataAdapter dim DT New DataTable adapter.SelectCommand = Command as Adapter.Fill (dt) dgvEmployee.D AtaSource = dt adapter.Dispose () command.Dispose () conF.Close () try pre-grab as exchanges  

You may want to do this SQL statement ...

  query = "Select (COUNT) (Employee_Name) FROM tblEmplo Yees where position_tale = 'employee 'And ("& TxtFilterType.Text & amp; "Like '%" & amp; Txtfilter.Text & amp; "% ')) In the form of a StaffCount, (select from TLEMOPO COUNT (employee's name) where position position = Title =' Supervisor 'and (" AND. And SupervisorCount, (Select COUNT (Employee_Name) from tblEmployees Position_Title = 'Manager' and ''% (& quot; like & amp; txtFilterType.Text & amp;; & quot; txtFilter.Text & amp; "% ')) ManagerCount, Employee_Name, P_Level, Position_Title, Department, ("%" & Amp; txtFilter.Text & amp; "% 'like" & amp; txtFilterType.Text & amp; / Pre> 

Then you should go to VB like this ...

  adapter.fi Ll (dt) txtStaff.Text = dt.rows (0) .emem ("StaffCount") txtSups.text = dt.Rows (0) .emem ("SupervisorCount") tstManagers.Text = dt.Rows (0) .emem Do not forget to hide ("ManagerCount")  

After filling the first 3 columns of your datagrid view, you are using the datasource property so that everything will come out, If you loop to display objects rather than using a data source, before you have more control over your datagrid view Keep it


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -