Is it possible to create a new DataRow object and add columns to it at runtime?
// How can I specify column names for this data row object?
DataRow row = new DataRow();
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.
I don’t think you can add columns to a datarow, but you certainly can to a datatable. Here’s some code to do this for VB:
The code uses an enumeration. I got some of the ideas from this page. The idea is that you can call the AddColumn method to add any column that you like to the datatable.