I’m trying to set the same value for all rows for a single column in a datatable without using for loop. Can anyone suggest any faster methods to achieve the same.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not unless you count
foreach. One way or another, you’ll need to loop.If you use the
DataTableversion, the fastest approach is to use theDataColumnaccessor, i.e.As an alternative : since this presumably relates to a database, write the TSQL manually to set all the values appropriately (i.e. with a suitable
whereclause in the TSQL).