I am trying to load all the groups into an Array
then loop through those groups and see how many assets they have per agent, if assets are more than agents than move them to our dummy group 0. but i am new to this DataSet
and TableAdapator
.
basically Group--agent--assets
0--0--10
1--3--3
2--3--5
3--10--15
so group 2 has 2 extra assets i want to move them to our empty group 0
Please guide
Dim rs, lines
rs = cn.Execute("select grp from tskmsgrp where listid = 0;")
Dim da As New System.Data.OleDb.OleDbDataAdapter()
Dim da_line As New System.Data.OleDb.OleDbDataAdapter()
Dim ds As New DataSet()
da.Fill(ds, rs, "grp")
MsgBox("There are total products." & ds.Tables(0).Rows.Count.ToString)
For Each a As DataRow In ds.Tables(0).Rows
lines = cn.Execute("select count(*) from tsklines where grp ='" & a(0) & "';")
Dim ds_lines As New DataSet()
da_line.Fill(ds_lines, lines, "lines")
MsgBox("Lines for group." & a(0) & " -- " & ds_lines.Tables(0).Rows.Count.ToString)
Next
A couple of points -- you can work out the details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.