Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigating through a dataset to find column values

Status
Not open for further replies.

Programming2007

Programmer
Nov 10, 2006
24
US
Hello how do I navigate through a dataset to find column values. My code looks something like this:
Dim myDS1 As New DataSet
Try


strSQL = "select TERMINATE_NUMBER,ORIGINATE_NUMBER,CALL_DATE,CALL_TIME" & _
"from ratesys_gc_cdr_bad " & _
"WHERE STATUS = 'M'"

cnOracle = New Oracle.DataAccess.Client.OracleConnection(strCNOracle)

cmdOracle = New Oracle.DataAccess.Client.OracleCommand(strSQL, cnOracle)
cmdOracleSelect = New Oracle.DataAccess.Client.OracleCommand(strSelectSQL, cnOracle)

daOracle.InsertCommand = cmdOracle


daOracleSelect.Fill(myDS1, "ratesys_gc_cdr_bad")

dgLoadMissingData.Visible = True

dgLoadMissingData.DataSource = myDS1
dgLoadMissingData.DataMember = "ratesys_gc_cdr_bad"

cmdOracle.ExecuteNonQuery()
///////////////////////////////////////////////////////////
That part works to fill a datagrid but now I need to do something else.What I need to do is compare the fields in my dataset which are the columns in my select statement and test them to see if they are equalivalent to some other data in my program, something like
while reading the table
DS1(field1) == myValue1
DS2(field2) == myValue2
stop reading

What is the syntax for writing that?
 
Hello,

To find columns values in the data grid you can do this.

Code:
for dim i = 0 to ds.table(0).rows.(0).count - 1 
dim gdValue = ds.table(0).rows(0).item("Column").tostring()
if(gdValue = value) then
'Do something
end if
next i

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top