Is it possible to assign a specific value to a column of a data set variable?

I have a dsProcesses dataset that returns some rows and columns. Now I need to save in a row all the data present in one particular column [Process ID] of this data set. Can any of u offer in detail.

+4
source share
3 answers

Yes, you can

String str = DataSet.Tables[0].Rows[RowIndex]["ColumnNameOrIndex"].ToString();
String str = DataSet.Tables["TableName"].Rows[0]["ColumnName"].ToString();

Take a look here

+2
source

This code will create a comma delimited string with the data from this column

        for (int i = 0; i < dsProcesses.Tables[0].Rows.Count; i++)
        {
            strprocessid = strprocessid + dsProcesses.Tables[0].Rows[i]["ProcessID"].ToString() + ",";
         }
        strprocessid = strprocessid.TrimEnd(',');
+1
source

...

DataSet ds = //call your data
        string sMyData = string.Empty;
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            sMyData = sMyData + "," + dr["ProcessID"].ToString();
        }
0

Source: https://habr.com/ru/post/1526131/


All Articles