📄 sypodlobjects.cpp
字号:
}
//*********************************************************************************
void CSypOLEDBErr::GetHRRESULTMessage(HRESULT hr, TCHAR *msg)
{
LPVOID lpMsgBuf;
HMODULE hModule = LoadLibrary(_T("C:\\Program Files\\Common Files\\System\\ole db\\MSDAERR.DLL"));
if(hModule)
{
long l = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_FROM_SYSTEM, hModule, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf, 0, NULL);
lstrcpy(msg, (LPTSTR)lpMsgBuf);
// Free the buffer.
LocalFree( lpMsgBuf );
FreeLibrary(hModule);
return;
}
_stprintf(msg, _T("%s\nERROR :"), msg, hr);
switch (hr)
{
case DB_E_ABORTLIMITREACHED :
_tcscat(msg, _T("\nYour execution was aborted because a resource limit has been reached. No results are returned when this error occurs."));
break;
case DB_E_ALREADYINITIALIZED :
_tcscat(msg, _T("\nYou tried to initialize a data source that has already been initialized."));
break;
case DB_E_BADACCESSORFLAGS :
_tcscat(msg, _T("\nInvalid accessor flags"));
break;
case DB_E_BADACCESSORHANDLE :
_tcscat(msg, _T("\nInvalid accessor handle"));
break;
case DB_E_BADACCESSORTYPE :
_tcscat(msg, _T("\nThe specified accessor was not a parameter accessor"));
break;
case DB_E_BADBINDINFO :
_tcscat(msg, _T("\nInvalid binding information"));
break;
case DB_E_BADBOOKMARK :
_tcscat(msg, _T("\nInvalid bookmark"));
break;
case DB_E_BADCHAPTER :
_tcscat(msg, _T("\nInvalid chapter"));
break;
case DB_E_BADCOLUMNID :
_tcscat(msg, _T("\nInvalid column ID"));
break;
case DB_E_BADCOMPAREOP :
_tcscat(msg, _T("\nThe comparison operator was invalid"));
break;
case DB_E_BADCONVERTFLAG :
_tcscat(msg, _T("\nInvalid conversion flag"));
break;
case DB_E_BADCOPY :
_tcscat(msg, _T("\nErrors were detected during a copy"));
break;
case DB_E_BADDYNAMICERRORID :
_tcscat(msg, _T("\nThe supplied DynamicErrorID was invalid"));
break;
case DB_E_BADHRESULT :
_tcscat(msg, _T("\nThe supplied HRESULT was invalid"));
break;
case DB_E_BADLOCKMODE :
_tcscat(msg, _T("\nInvalid lock mode"));
break;
case DB_E_BADLOOKUPID :
_tcscat(msg, _T("\nInvalid LookupID"));
break;
case DB_E_BADORDINAL :
_tcscat(msg, _T("\nThe specified column number does not exist."));
break;
case DB_E_BADPARAMETERNAME :
_tcscat(msg, _T("\nThe given parameter name is not recognized."));
break;
case DB_E_BADPRECISION :
_tcscat(msg, _T("\nA specified precision is invalid"));
break;
case DB_E_BADPROPERTYVALUE :
_tcscat(msg, _T("\nThe value of a property is invalid"));
break;
case DB_E_BADRATIO :
_tcscat(msg, _T("\nInvalid ratio"));
break;
case DB_E_BADRECORDNUM :
_tcscat(msg, _T("\nThe specified record number is invalid"));
break;
case DB_E_BADROWHANDLE :
_tcscat(msg, _T("\nInvalid row handle. This error often occurs when you are at BOF or EOF of a rowset and you try to update your data set."));
break;
case DB_E_BADSCALE :
_tcscat(msg, _T("\nA specified scale was invalid"));
break;
case DB_E_BADSOURCEHANDLE :
_tcscat(msg, _T("\nInvalid source handle"));
break;
case DB_E_BADSTARTPOSITION :
_tcscat(msg, _T("\nThe rows offset specified would position you before the beginning or past the end of the rowset."));
break;
case DB_E_BADSTATUSVALUE :
_tcscat(msg, _T("\nThe specified status flag was neither DBCOLUMNSTATUS_OK nor DBCOLUMNSTATUS_ISNULL"));
break;
case DB_E_BADSTORAGEFLAG :
_tcscat(msg, _T("\nOne of the specified storage flags was not supported"));
break;
case DB_E_BADSTORAGEFLAGS :
_tcscat(msg, _T("\nInvalid storage flags"));
break;
case DB_E_BADTABLEID :
_tcscat(msg, _T("\nInvalid table ID"));
break;
case DB_E_BADTYPE :
_tcscat(msg, _T("\nA specified type was invalid"));
break;
case DB_E_BADTYPENAME :
_tcscat(msg, _T("\nThe given type name was unrecognized"));
break;
case DB_E_BADVALUES :
_tcscat(msg, _T("\nInvalid value"));
break;
case DB_E_BOOKMARKSKIPPED :
_tcscat(msg, _T("\nAlthough the bookmark was validly formed, no row could be found to match it"));
break;
case DB_E_BYREFACCESSORNOTSUPPORTED :
_tcscat(msg, _T("\nBy reference accessors are not supported by this provider"));
break;
case DB_E_CANCELED :
_tcscat(msg, _T("\nThe change was canceled during notification; no columns are changed"));
break;
case DB_E_CANNOTRESTART :
_tcscat(msg, _T("\nThe rowset was built over a live data feed and cannot be restarted."));
break;
case DB_E_CANTCANCEL :
_tcscat(msg, _T("\nThe executing command cannot be canceled."));
break;
case DB_E_CANTCONVERTVALUE :
_tcscat(msg, _T("\nA literal value in the command could not be converted to the correct type due to a reason other than data overflow."));
break;
case DB_E_CANTFETCHBACKWARDS :
_tcscat(msg, _T("\nThe rowset does not support backward scrolling."));
break;
case DB_E_CANTFILTER :
_tcscat(msg, _T("\nThe requested filter could not be opened."));
break;
case DB_E_CANTORDER :
_tcscat(msg, _T("\nThe requested order could not be opened."));
break;
case DB_E_CANTSCROLLBACKWARDS :
_tcscat(msg, _T("\nThe rowset cannot scroll backwards."));
break;
case DB_E_CANTTRANSLATE :
_tcscat(msg, _T("\nCannot represent the current tree as text."));
break;
case DB_E_CHAPTERNOTRELEASED :
_tcscat(msg, _T("\nThe rowset was single-chaptered and the chapter was not released when a new chapter formation is attempted."));
break;
case DB_E_CONCURRENCYVIOLATION :
_tcscat(msg, _T("\nThe rowset was using optimistic concurrency and the value of a column has been changed since it was last read."));
break;
case DB_E_DATAOVERFLOW :
_tcscat(msg, _T("\nA literal value in the command overflowed the range of the type of the associated column"));
break;
case DB_E_DELETEDROW :
_tcscat(msg, _T("\nThe row that is referred to has been deleted."));
break;
case DB_E_DIALECTNOTSUPPORTED :
_tcscat(msg, _T("\nThe provider does not support the specified dialect"));
break;
case DB_E_DUPLICATECOLUMNID :
_tcscat(msg, _T("\nA column ID was occurred more than once in the specification"));
break;
case DB_E_DUPLICATEDATASOURCE :
_tcscat(msg, _T("\nA new data source is trying to be formed when a data source with that specified name already exists."));
break;
case DB_E_DUPLICATEINDEXID :
_tcscat(msg, _T("\nThe specified index already exists."));
break;
case DB_E_DUPLICATETABLEID :
_tcscat(msg, _T("\nThe specified table already exists."));
break;
case DB_E_ERRORSINCOMMAND :
_tcscat(msg, _T("\nThe command contained one or more errors."));
break;
case DB_E_ERRORSOCCURRED :
_tcscat(msg, _T("\nErrors occurred. This message is thrown when an error occurs that is not captured by one of the other error messages."));
break;
case DB_E_INDEXINUSE :
_tcscat(msg, _T("\nThe specified index was in use."));
break;
case DB_E_INTEGRITYVIOLATION :
_tcscat(msg, _T("\nA specified value violated the referential integrity constraints for a column or table."));
break;
case DB_E_INVALID :
_tcscat(msg, _T("\nThe rowset is invalide."));
break;
case DB_E_MAXPENDCHANGESEXCEEDED :
_tcscat(msg, _T("\nThe number of rows with pending changes has exceeded the set limit."));
break;
case DB_E_MULTIPLESTATEMENTS :
_tcscat(msg, _T("\nThe provider does not support multi-statement commands."));
break;
case DB_E_MULTIPLESTORAGE :
_tcscat(msg, _T("\nMultiple storage objects can not be open simultaneously."));
break;
case DB_E_NEWLYINSERTED :
_tcscat(msg, _T("\nThe provider is unable to determine identity for newly inserted rows."));
break;
case DB_E_NOAGGREGATION :
_tcscat(msg, _T("\nA non-NULL controlling IUnknown was specified and the object being created does not support aggregation."));
break;
case DB_E_NOCOMMAND :
_tcscat(msg, _T("\nNo command has been set for the command object."));
break;
case DB_E_NOINDEX :
_tcscat(msg, _T("\nThe specified index does not exist."));
break;
case DB_E_NOLOCALE :
_tcscat(msg, _T("\nThe specified locale ID was not supported."));
break;
case DB_E_NOQUERY :
_tcscat(msg, _T("\nInformation was requested for a query, and the query was not set."));
break;
case DB_E_NOTABLE :
_tcscat(msg, _T("\nThe specified table does not exist."));
break;
case DB_E_NOTAREFERENCECOLUMN :
_tcscat(msg, _T("\nSpecified column does not contain bookmarks or chapters."));
break;
case DB_E_NOTFOUND :
_tcscat(msg, _T("\nNo key matching the described characteristics could be found within the current range."));
break;
case DB_E_NOTPREPARED :
_tcscat(msg, _T("\nThe command was not prepared."));
break;
case DB_E_NOTREENTRANT :
_tcscat(msg, _T("\nProvider called a method from IRowsetNotify in the consumer and the method has not yet returned."));
break;
case DB_E_NOTSUPPORTED :
_tcscat(msg, _T("\nThe provider does not support this method."));
break;
case DB_E_NULLACCESSORNOTSUPPORTED :
_tcscat(msg, _T("\nNull accessors are not supported by this provider."));
break;
case DB_E_OBJECTOPEN :
_tcscat(msg, _T("\nAn object was open."));
break;
case DB_E_PARAMNOTOPTIONAL :
_tcscat(msg, _T("\nNo value given for one or more required parameters."));
break;
case DB_E_PARAMUNAVAILABLE :
_tcscat(msg, _T("\nThe provider cannot derive parameter info and SetParameterInfo has not been called."));
break;
case DB_E_PENDINGCHANGES :
_tcscat(msg, _T("\nThere are pending changes on a row with a reference count of zero."));
break;
case DB_E_PENDINGINSERT :
_tcscat(msg, _T("\nUnable to get visible data for a newly-inserted row that has not yet been updated."));
break;
case DB_E_READONLYACCESSOR :
_tcscat(msg, _T("\nUnable to write with a read-only accessor."));
break;
case DB_E_ROWLIMITEXCEEDED :
_tcscat(msg, _T("\nCreating another row would have exceeded the total number of active rows supported by the rowset."));
break;
case DB_E_ROWSETINCOMMAND :
_tcscat(msg, _T("\nCannot clone a command object whose command tree contains a rowset or rowsets."));
break;
case DB_E_ROWSNOTRELEASED :
_tcscat(msg, _T("\nAll HROWs must be released before new ones can be obtained."));
break;
case DB_E_SCHEMAVIOLATION :
_tcscat(msg, _T("\nGiven values violate the database schema."));
break;
case DB_E_TABLEINUSE :
_tcscat(msg, _T("\nThe specified table was in use."));
break;
case DB_E_UNSUPPORTEDCONVERSION :
_tcscat(msg, _T("\nRequested conversion is not supported."));
break;
case DB_E_WRITEONLYACCESSOR :
_tcscat(msg, _T("\nThe given accessor was write-only."));
break;
case DB_S_ASYNCHRONOUS :
_tcscat(msg, _T("\nThe operation is being processed asynchronously."));
break;
case DB_S_BADROWHANDLE :
_tcscat(msg, _T("\nInvalid row handle. This error often occurs when you are at BOF or EOF of a rowset and you try to update your data set."));
break;
case DB_S_BOOKMARKSKIPPED :
_tcscat(msg, _T("\nSkipped bookmark for deleted or non-member row."));
break;
case DB_S_BUFFERFULL :
_tcscat(msg, _T("\nVariable data buffer full. Increase system memory, commit open transactions, free more system memory, or declare larger buffers in you database setup."));
break;
case DB_S_CANTRELEASE :
_tcscat(msg, _T("\nServer cannot release or downgrade a lock until the end of the transaction."));
break;
case DB_S_COLUMNSCHANGED :
_tcscat(msg, _T("\nIn order to reposition to the start of the rowset, the provider had to reexecute the query; either the order of the columns changed or columns were added to or removed from the rowset."));
break;
case DB_S_COLUMNTYPEMISMATCH :
_tcscat(msg, _T("\nOne or more column types are incompatible. Conversion errors will occur during copying."));
break;
case DB_S_COMMANDREEXECUTED :
_tcscat(msg, _T("\nThe provider re-executed the command."));
break;
case DB_S_DELETEDROW :
_tcscat(msg, _T("\nA given HROW referred to a hard-deleted row."));
break;
case DB_S_DIALECTIGNORED :
_tcscat(msg, _T("\nInput dialect was ignored and text was returned in different dialect."));
break;
case DB_S_ENDOFROWSET :
_tcscat(msg, _T("\nReached start or end of rowset or chapter."));
break;
case DB_S_ERRORSOCCURRED :
_tcscat(msg, _T("\nErrors occurred. DB_S_ERRORSOCCURRED flag was set."));
break;
case DB_S_ERRORSRETURNED :
_tcscat(msg, _T("\nThe method had some errors; errors have been returned in the error array."));
break;
case DB_S_LOCKUPGRADED :
_tcscat(msg, _T("\nA lock was upgraded from the value specified."));
break;
case DB_S_MULTIPLECHANGES :
_tcscat(msg, _T("\nUpdating this row caused more than one row to be updated in the data source."));
break;
case DB_S_NONEXTROWSET :
_tcscat(msg, _T("\nThere are no more rowsets."));
break;
case DB_S_NORESULT :
_tcscat(msg, _T("\nThere are no more results."));
break;
case DB_S_PARAMUNAVAILABLE :
_tcscat(msg, _T("\nA specified parameter was invalid."));
break;
case DB_S_PROPERTIESCHANGED :
_tcscat(msg, _T("\nOne or more properties were changed as allowed by provider."));
break;
case DB_S_ROWLIMITEXCEEDED :
_tcscat(msg, _T("\nFetching requested number of rows would have exceeded total number of active rows supported by the rowset."));
break;
case DB_S_STOPLIMITREACHED :
_tcscat(msg, _T("\nExecution stopped because a resource limit has been reached. Results obtained so far have been returned but execution cannot be resumed."));
break;
case DB_S_TYPEINFOOVERRIDDEN :
_tcscat(msg, _T("\nCaller has overridden parameter type information."));
break;
case DB_S_UNWANTEDOPERATION :
_tcscat(msg, _T("\nConsumer is uninterested in receiving further notification calls for this reason"));
break;
case DB_S_UNWANTEDPHASE :
_tcscat(msg, _T("\nConsumer is uninterested in receiving further notification calls for this phase"));
break;
case DB_S_UNWANTEDREASON :
_tcscat(msg, _T("\nConsumer is uninterested in receiving further notification calls for this reason."));
break;
case DB_SEC_E_AUTH_FAILED :
_tcscat(msg, _T("\nAuthentication failed"));
break;
case DB_SEC_E_PERMISSIONDENIED :
_tcscat(msg, _T("\nPermission denied"));
break;
case MD_E_BADCOORDINATE :
_tcscat(msg, _T("\nBad coordinate for the OLAP dataset."));
break;
case MD_E_BADTUPLE :
_tcscat(msg, _T("\nBad tuple for the OLAP dataset"));
break;
case MD_E_INVALIDAXIS :
_tcscat(msg, _T("\nThe given axis was not valid for this OLAP dataset."));
break;
case MD_E_INVALIDCELLRANGE :
_tcscat(msg, _T("\nOne or more of the given cell ordinals was invalid for this OLAP dataset."));
break;
#if(OLEDBVER >= 0x0250)
//Errors if OLE DB version is greater than 2.5
case DB_E_BADREGIONHANDLE :
_tcscat(msg, _T("\nInvalid region handle"));
break;
case DB_E_CANNOTFREE :
_tcscat(msg, _T("\nOwnership of this tree has been given to the provider. You cannot free the tree."));
break;
case DB_E_COSTLIMIT :
_tcscat(msg, _T("\nUnable to find a query plan within the given cost limit"));
break;
case DB_E_GOALREJECTED :
_tcscat(msg, _T("\nNo nonzero weights specified for any goals supported, so goal was rejected; current goal was not changed."));
break;
case DB_E_INVALIDTRANSITION :
_tcscat(msg, _T("\nA transition from ALL* to MOVE* or EXTEND* was specified."));
break;
case DB_E_LIMITREJECTED :
_tcscat(msg, _T("\nSome cost limits were rejected."));
break;
case DB_E_NONCONTIGUOUSRANGE :
_tcscat(msg, _T("\nThe specified set of rows was not contiguous to or overlapping the rows in the specified watch region."));
break;
case DB_S_GOALCHANGED :
_tcscat(msg, _T("\nSpecified weight was not supported or exceeded the supported limit and was set to 0 or the supported limit."));
break;
case DB_S_TOOMANYCHANGES :
_tcscat(msg, _T("\nThe provider was unable to keep track of all the changes. You must refetch the data associated with the watch region using another method."));
break;
#endif //OLEDBVER >= 0x0250
// BLOB ISequentialStream errors
case STG_E_INVALIDFUNCTION :
_tcscat(msg, _T("\nYou tried an invalid function."));
break;
case S_FALSE :
_tcscat(msg, _T("\nS_FALSE was returned. The ISequentialStream data could not be read from the stream object."));
break;
case E_PENDING :
_tcscat(msg, _T("\nAsynchronous Storage only: Part or all of the data to be written is currently unavailable. For more information, see IFillLockBytes and Asynchronous Storage in MSDN."));
break;
case STG_E_MEDIUMFULL :
_tcscat(msg, _T("\nThe write operation was not completed because there is no space left on the storage device."));
break;
case STG_E_ACCESSDENIED :
_tcscat(msg, _T("\nThe caller does not have sufficient permissions for writing this stream object."));
break;
case STG_E_CANTSAVE :
_tcscat(msg, _T("\nData cannot be written for reasons other than lack of access or space."));
break;
case STG_E_INVALIDPOINTER :
_tcscat(msg, _T("\nOne of the pointer values is invalid."));
break;
case STG_E_REVERTED :
_tcscat(msg, _T("\nThe object has been invalidated by a revert operation above it in the transaction tree."));
break;
case STG_E_WRITEFAULT :
_tcscat(msg, _T("\nThe write operation was not completed due to a disk error."));
break;
default :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -