How to assign value to DataTable column Row in c#

I am using c# in an activity . I need to assign a number to DataTable Column Cell. How to do it . Please help.
91

Hi @Ravindra_Kumar

What is the error you are getting?

Thanks

Hi @Ravindra_Kumar

If AddResult value is not type of string. Use AddResult.ToString()

Thank you.

I have shared pic please check

I did but still error

@Ravindra_Kumar the error is because dt.columns[“columnname”] output is datacolumn,

Try to use,

For update the first row and specific column

Dt.rows[0]["Addresult"] = addresult

change the row number as you want.

Thanks

Please mention your full requirement clearly.

This is how usually we perform the column value in c#,

DataRow dr = dt.NewRow();
dr[3].Value = “Some Value”;
dt.Rows.Add(dr);

Thank you.

Thanks to all ! It resolved

@Ravindra_Kumar happy that your problem is resolved, please mark tha appropriate answer as solution and close the thread so it may be useful to others in the future.

Thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.