Dataset Object
In c sharp How to Set or return the name of the current index for a dataset object. Can someone post and example or lead me to the right place?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Oct 14, 2014, 8:01 AM EDT
Although you can't index the DataSet itself, you can index its Tables and Relations properties. This can be done either numerically (starting from 0) or by name.
So, for example, if you wanted to get a reference to the first (or only) DataTable in some DataSet (ds, say), you could do it either like this:
DataTable dt = ds.Tables[0];
or like this:
DataTable dt = ds.Tables["MyTableName"];
All DataTables have a TableName property which returns their name and a DataSet property which returns a reference to the DataSet to which they belong.
David SmithRank #999 · 2K reputationPosted Oct 14, 2014, 8:41 AM EDT