我在试图更新Excel书时正在发现这一错误:
Server Error in /ReadExcelData_Csharp Application.
Operation must use an updateable query.
and here is the code that i am using :
querys = "UPDATE [Sheet1$] "+"SET [Number]=" +s.Trim()+ " WHERE [Number]=" + s2.Trim() ;
objcmc = new OleDbCommand(querys, conn);
objcmc.ExecuteNonQuery();
任何帮助都将受到赞赏。
这里指的是:
if (strFileType.Trim() == ".xls")
{
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strNewPath + ";Extended Properties="Excel 8.0;HDR=Yes;IMEX=2"";
}
else if (strFileType.Trim() == ".xlsx")
{
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strNewPath + ";Extended Properties="Excel 12.0;HDR=Yes;IMEX=2"";
}