Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using datagridview and i am binding my excel file to datagridview. I am able to read from excel file as well as insert to that file using datagridview. But I am not able to delete and update that file. It's giving error that "Deleting data in a linked table is not supported by this ISAM.". Is there any other best method to perform these operation on excel file using datagridview. Or simply how can I delete, update record in Excel file using datagridview in C#.
Posted

1 solution

 
Share this answer
 
Comments
rcreation33 22-Feb-12 8:16am    
private void deleteButton_Click(object sender, EventArgs e)
{
OleDbConnection myConn = new OleDbConnection(connectionString);

string excelDelete = "DELETE FROM [Sheet1$] WHERE ID = '" + dgvExcelList["ID", dgvExcelList.CurrentRow.Index].Value.ToString() + "'";
OleDbCommand Deletecmd = new OleDbCommand(excelDelete, myConn);
myConn.Open();
Deletecmd.ExecuteNonQuery();
myConn.Close();
}

I am using above code but is giving error that "Deleting data in a linked table is not supported by this ISAM."

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900