Not so subtle bug... [modified]
-
Microsoft is interested in this issue and they are actively seeking a resolution. After KB950749 was installed by Windows Update, we started getting exceptions from some of our old DAO legacy applications. This particular type of line is used throughout our code:
fldNew = tdfDestTable->CreateField(_T("MyField5"), DAO::dbText, 12);
Out of the blue, the above line of code starting throwing exceptions with a DAO error of 3421 We traced it back to the installation of KB950749 which is a fix for some MSJet 4.0 security issues. Uninstalling KB950749 enables the legacy applications to work. However, this is not desirable, due to the fixes contained in KB950749. After a little experimenting, here's what works and what doesn't. I doubt this affects many users here, but just in case, here is what I've found:
fldNew = tdfDestTable->CreateField(_T("MyField0"), (short) DAO::dbText, (short) 12); // works
fldNew = tdfDestTable->CreateField(_T("MyField1"), (long) DAO::dbText, (long) 12); // works
fldNew = tdfDestTable->CreateField(_T("MyField2"), CComVariant(DAO::dbText), CComVariant(12)); // works
fldNew = tdfDestTable->CreateField(_T("MyField3"), _variant_t(DAO::dbText), _variant_t(12)); // An exception occurs here, DAO error 3421
fldNew = tdfDestTable->CreateField(_T("MyField4"), (int) DAO::dbText, (int) 12); // An exception occurs here, DAO error 3421
// The following line used to work before KB950749 was installed. It is representative of what we have in production
fldNew = tdfDestTable->CreateField(_T("MyField5"), DAO::dbText, 12); // An exception occurs here, DAO error 3421I find it really weird that CreateField will take a long and a short, but not an int. This is caused by the way _variant_t casts numbers. CComVariant defaults to longs, whereas _variant_t defaults to int for numbers. However, the real issue is that CreateField no longer accepts VARIANT of type VT_INT! They have to be VT_I4 or VT_I2. Ouch!
CodeWiz51 -- Life is not a spectator sport. I came to play. Code's Musings | Code's Articles
modified on Friday, May 16, 2008 5:28 PM