TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
692
1.3k
219.3k
Remove a datatable column
Apr 28 2015 11:39 AM
Hi!
I wrote this code to try to remove the "FirstName" column. Curiosly, I receive this error. Please could you have a look?
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Research\Documents\Windows_Application_Samples\Rename_Column_Tablename\WindowsFormsApplication1\App_Data\visa.mdb;Persist Security Info=False");
DataTable table = new DataTable();
table.Columns.Add("name", typeof(int));
table.Columns.Add("function", typeof(string));
table.Columns.Add("date", typeof(DateTime));
table.Columns.Add("FirstName", typeof(string));*/
DataColumn column;
for (int i = 0; i < table.Columns.Count; i++)
{
column = table.Columns[i];
MessageBox.Show(column.ColumnName, i.ToString());
}
table.Columns["FirstName"].SetOrdinal(1);
for (int i = 0; i < table.Columns.Count; i++)
{
column = table.Columns[i];
MessageBox.Show(column.ColumnName, i.ToString());
}
Reply
Answers (
9
)
one parent node select time next parent node automatically
How to get text from DropDownList in .Net-MVC?