Tuesday, August 23, 2011

Excel Value to String

Query: How can i create a generic method for returning string values from excel.

Answer:

// convert into str from excel cell value
str COMVariant2Str(COMVariant _cv,
                    int _decimals = 0,
                        int _characters = 0,
                        int _separator1 = 0,
                        int _separator2 = 0)
{
    switch (_cv.variantType())
    {
        case (COMVariantType::VT_BSTR):
            return _cv.bStr();

        case (COMVariantType::VT_R4):
            return num2str(_cv.float(),_characters,_decimals,_separator1,_separator2);

        case (COMVariantType::VT_R8):
            return num2str(_cv.double(),_characters,_decimals,_separator1,_separator2);

        case (COMVariantType::VT_DECIMAL):
            return num2str(_cv.decimal(),_characters,_decimals,_separator1,_separator2);

        case (COMVariantType::VT_DATE):
            return date2str(_cv.date(),123,2,1,2,1,4);

        case (COMVariantType::VT_EMPTY):
            return "";

        default:
            throw error(strfmt("@SYS26908", _cv.variantType()));
    }
    return "";
}

Wednesday, August 17, 2011

Corrupted applicationHost.config

Query:
The IIS file applicationHost.config got corrupted today, is there any way i can regenerate?

Answer:
You can restore from the backup placed at C:\inetpub\history

Monday, August 15, 2011

ssrs unable to load client print control on windows 2003

Query:
I am getting an issue when trying to print the SSRS reports. It keeps saying "unable to load client print control".


Answer:

Uninstall KB KB956390