newbie - get value of field from datatable syntax

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I have a datatable containing 1 row and a few columns.

I simply want to retrieve the value of the 'nameid' column and store it
as an integer in a variable.

Dim data As Data.DataTable
data = MyObject.MyMethod(parameter) 'Returns 1 row with several columns
including a 'nameid' column

Dim id as Integer
id = 'value in the nameid column (don't know syntax)

I am coding vb.net in asp.net 2.0
 
id = CType(data.Rows(0).("nameid"), Integer)

is the safest, assuming there is only one row, of course. Strongly typed
DataSets/tables make it even easier.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top