I wonder what is the right approach for getting tables from dataset.

should i return the data within my procedure with select statement?

this is how i do it ,it works but i am not sure this is the right way.

SELECT SCOPE_IDENTITY()

and this is how i access my table:

ds.Tables[0].Rows[0][0]).ToString()
1

Best Answer


You might want to try using DataRow and looping though the set

foreach(DataRow row in ds.Tables[0]){string someData = row["keyname"].ToString();}

I'm unsure of your question in the first place. But MSDN has a lot of ducumentation, and you can read up on more data structures that can help with DataTables and how to access them. And even query the DataTable with linq like this

var results = from myRow in myDataTable.AsEnumerable()where myRow.Field<int>("RowNo") == 1select myRow;