simplest way how loop , display through records using textbox, combo box , datetimepicker.
below code still cant figure out
dim dr datarow dim ds dataset dim dt datatable <code fill dataset> dt = ds.tables(0) each dr in dt.rows console.writeline (dr("colname")) next ds.dispose()
you need 2 loops - outer loop number of rows in table, , inner loop columns in each row.
you have each rows already, need know how many columns in datarow
, , print out value in each column. can count of columns datatable
.
dim cols integer cols = dt.columns.count - 1 each dr in dt.rows integer = 0 cols console.writeline(dr(i).tostring()) next next
notice call tostring()
on value returned each column, , reference column it's ordinal. when access specific column in datarow, returns object
, you'll need cast value correct data type use in program.
the code posted have printed value column had "colname" it's column name each row. if didn't have column named "colname" see error.
Comments
Post a Comment