Isolate Dataset result

Shaitan00

Well-known member
Joined
Aug 11, 2003
Messages
343
Location
Hell
Given a Dataset [oRecs] generated by an SQL query.
I want to isolate/extrat some specific date

C# CODE:
oRecs = oDB.GetRecords("select [X] from
where [Y] = " + strName + "");

This will generate a dataset [oRecs] with one row of data [only one result from the query] and one column [X].
I need to pass that value in Column [X] (as a string) to a function on the next line.

So the question is, how do I isolate the value in the Dataset itself?
 
Youd probably be better off using a Command objects ExecuteScalar function, which is meant to be used when you have exactly one value being returned from a query.

If you want to use the DataSet, try something like:
string s = oRecs.Tables[0].Rows[0][0].ToString();

There are a LOT of assumptions there, but you get the idea.

-ner
 
Back
Top