Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

 

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?

  • *Experts*
Posted

You'd probably be better off using a Command object's 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

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...