C++ is using ADO to add, search, and update lines for Excel files.I can't just delete it.Is there such a restriction when I specify Excel files in ADO?Cannot identify error.
CSstring strFile=_T("C:\\temp\\sample.xlsx");
CStrings;
try
{
CSstring strCon;
strCon.Format(_T("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=%s; Extended Properties=Excel 12.0xml"), strFile);
con.CreateInstance(__uuidof(Connection)));
con->Open(_bstr_t(strCon), '' , '' , adConnectUnspecified);
_RecordsetPtrrs;
rs.CreateInstance(__uuidof(Recordset)));
rs->CursorLocation=adUseClient;
rs->Open(_variant_t("SELECT* FROM [test$] WHERE [ID] = 'A1' ), con.GetInterfacePtr(), adOpenForwardOnly, adLockOptimistic, adCmdText);
if(!rs->GetadoEOF())
{
rs->Delete (adAffectCurrent);
rs->Close();
}
}
catch(_com_error&e)
{
s=e.ErrorMessage();
}
Unfortunately, your Microsoft.ACE.OLEDB.12.0 has been distributed, but no documentation has been provided, so I can only say that I don't know how it behaves.
The MDAC of the predecessor of this ? is already scattered documents.Microsoft Excel Driver Programming Consultations/Read-Only Status (Excel Driver)
It is possible to update values when using the Microsoft Excel driver, but can't be deleted from a table based on a Microsoft Excel spreadsheet, so updates are not considered officially supported by the Microsoft Excel driver.
said he.ACE has taken over the same specification, and line deletion is not supported.
© 2024 OneMinuteCode. All rights reserved.