B
Bernie Yaeger
Let's say I create a dataset/datatable thusly:
Dim daprod As New SqlDataAdapter("select * from anreport order by bipad,
issuecode", oconn)
Dim dsprod As New DataSet("prod")
daprod.Fill(dsprod, "prod")
Then I set up a dataview using this table, in the same order:
Dim arrayseekp(1) As Object
Dim ifindp As Integer
Dim vuep As New DataView(dsprod.Tables(0))
vuep.Sort = "bipad, issuecode"
Dim xbipad, xissuecode As String
Dim irow as datarow
For Each irow In dsprod.Tables(0).Rows
arrayseekp(0) = irow("bipad")
arrayseekp(1) = irow("issuecode")
ifindp = vuep.Find(arrayseekp)
If ifindp <> -1 Then ' found it
xbipad = vuep(ifindp - 1)("bipad")
xissuecode = vuep(ifindp - 1)("issuecode")
End If
Next
Here's the question: will index ifindp - 1 be in fact the row above the
found row, such that if I find '12345' '200209', ifindp - 1 will be '12345'
'200208' (if there is one, or else '12344' etc)?
Thanks for any help.
Bernie Yaeger
Dim daprod As New SqlDataAdapter("select * from anreport order by bipad,
issuecode", oconn)
Dim dsprod As New DataSet("prod")
daprod.Fill(dsprod, "prod")
Then I set up a dataview using this table, in the same order:
Dim arrayseekp(1) As Object
Dim ifindp As Integer
Dim vuep As New DataView(dsprod.Tables(0))
vuep.Sort = "bipad, issuecode"
Dim xbipad, xissuecode As String
Dim irow as datarow
For Each irow In dsprod.Tables(0).Rows
arrayseekp(0) = irow("bipad")
arrayseekp(1) = irow("issuecode")
ifindp = vuep.Find(arrayseekp)
If ifindp <> -1 Then ' found it
xbipad = vuep(ifindp - 1)("bipad")
xissuecode = vuep(ifindp - 1)("issuecode")
End If
Next
Here's the question: will index ifindp - 1 be in fact the row above the
found row, such that if I find '12345' '200209', ifindp - 1 will be '12345'
'200208' (if there is one, or else '12344' etc)?
Thanks for any help.
Bernie Yaeger