Retrieving a value from a Dataset

Shaitan00

Well-known member
Joined
Aug 11, 2003
Messages
343
Location
Hell
Given a Dataset [ds] which contains 1 row and 3 columns [Username, Password, Level].
ds: Table[0]: Username Password Level
Name Pass 2

I need to store the value of Level [from ds] into a created variable [savedLevel], currently I am trying via this method:
savedLevel = ds.Tables[0].Columns[2].ToString();
However this stores the string
 
Try this (its c#):

DataTable dt = ds.Tables[0];
savedLevel = dt.Rows[0]["Level"].ToString();

This will return row 0 from the 3rd column (Level).

Hope this helped.
 
Back
Top