I want to rename my DataTable column names.
I tried this:
dt.Columns[8].ColumnName = "regnum";
dt.AcceptChanges();
but my data is lost afterwards.
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.
This just binds your
Columns[8]to the non-existing “regnum” column in the Db.If you want to rename the actuals Db column, execute an SQL script.
But my guess is you actually want to change the Caption: