OK - a DataSet is a Collection of DataTables. In this case, a single table (but do check):
if (ds.Tables.Count > 0)
{
DataTable dt = ds.Tables[0];
...
And a DataTable is a collection of DataRows. In this case, it should be a single row, but again, check first.
if (dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[0];
...
And a DataRow is a collection of cells. The data you want in is the cells.
There are two ways to access those: by index or by Column Name. Since you don't specify the columns you want from your table (and you should) I can't fill it all in for you, but...all you then have to do is cast it to the right data type:
if (ds.Tables.Count > 0)
{
DataTable dt = ds.Tables[0];
if (dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[0];
string str1 = (string)dr[0];
string str2 = (string)dr[1];
string str3 = (string)dr[2];
}
}
Or (better)
if (ds.Tables.Count > 0)
{
DataTable dt = ds.Tables[0];
if (dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[0];
string str1 = (string)dr["Column1 name"];
string str2 = (string)dr["Column2 name"];
string str3 = (string)dr["Column3 name"];
}
}
Using names, and listing the columns you want to return is better practice, since it means your code doesn't crash if the underlying table is changed, and it doesn't return unnecessary columns which can seriously slow things down.