I have not got any problems with this code within 20 years but I think it needs to correct it with:
LONG lSchemaType; /*DBTYPE == UI2*/
if(ConvertToLONG(pwszValue, &lSchemaType, 0/*Min*/, USHRT_MAX, 0/*Base*/))
{
//NOTE: on failure we have no choice to leave the column as the original
//returned integer.
StringCopy(pwszValue, GetDBTypeName((DBTYPE)lSchemaType), ulMaxSize);
}
I tested this new code under debugger - it works fine.
VS Debugger found a problem with the following code:
https://github.com/microsoft/Windows-classic-samples/blob/7cbd99ac1d2b4a0beffbaba29ea63d024ceff700/Samples/Win7Samples/dataaccess/oledb/rowsetviewer/crowset.cpp#L671-L672
DBTYPE is based on USHORT datatype.
I have not got any problems with this code within 20 years but I think it needs to correct it with:
I tested this new code under debugger - it works fine.