access@123 0 Newbie Poster

hi
i have a window application, wherein i have to choose the database,its table and rowfields present in the table at runtime. Now i want to remove all the duplicates from database. my database is access and whichever row field the user chooses the duplicates should be removed leaving the latest updated row. Please help me my code is as below..

string str = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + txtPath.Text; 
OleDbConnection con = new OleDbConnection(str); 

string t = "select * from " + cmbtables.SelectedItem.ToString(); 
OleDbDataAdapter adt = new OleDbDataAdapter(t, str); 
con.Open();
DataSet ds = new DataSet(); 


adt.Fill(ds);

DataTable dt = ds.Tables[0]; 
con.Close();
dt = RemoveDuplicateRows(dt, cmbRow.SelectedItem.ToString());


private DataTable RemoveDuplicateRows(DataTable dTable, string colName)
{
Hashtable hTable = new Hashtable();
ArrayList duplicateList = new ArrayList();
foreach (DataRow drow in dTable.Rows)
{
if (hTable.Contains(drow[colName]))
duplicateList.Add(drow);
else
hTable.Add(drow[colName], string.Empty);
}
foreach (DataRow dRow in duplicateList)
dTable.Rows.Remove(dRow);
return dTable;
}

when i use datatable.update it is giving me error pls pls pls help me its urgent

hoping for your co-operation
Thank you