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());
}
Vincent Maverick DuranoPosted May 4, 2015, 9:55 AM
IsraelPosted May 4, 2015, 9:36 AM
Your codes doesnt work and doesnt give buggs.
Nothing its happening when running and its doesnt remove any column as needed.
Vincent Maverick DuranoPosted Apr 29, 2015, 12:43 PM
IsraelPosted Apr 29, 2015, 12:10 PM
Vincent Maverick DuranoPosted Apr 29, 2015, 11:02 AM
IsraelPosted Apr 29, 2015, 10:58 AM
using (var con = new OleDbConnection(ConfigurationSettings.AppSettings[@"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"]))
Vincent Maverick DuranoPosted Apr 29, 2015, 10:06 AM
IsraelPosted Apr 29, 2015, 9:23 AM
Just looping (showing field name in box message).
When you get in the table there is no column removed.
Afzaal Ahmad ZeeshanPosted Apr 28, 2015, 12:32 PM