I want to retrieve only one column from dataset or datatable. the dataset has one table and that table has many column. But I want only one column from that table. How can i do it?
And that will be still in a dataSet, not in a string.

Recommended Answers

All 2 Replies

may be this is what you want :
int val
val = Convert.ToInt32(ds.Tables[0].Rows[0]["FieldName"]);

//Table with multiple columns
            DataTable dt1 = new DataTable();

            //Table with chosen column
            DataTable dt2 = dt1.Columns["ColumnName"].Table;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.