I have a table on my MSSQL server with a column defined as decimal(8,2).
From my c++ app I define the following parameter to be passed to the sp.
pParam1 = pCommand->CreateParameter (
_bstr_t ("Thing"),
adDecimal,
adParamInput,
8,
(_variant_t) thing);
pCommand->Parameters->Append (pParam1);
I get an error "Invalid precision".
How do I开发者_如何学C have to define the precision in the pParam1 setup to make it match the definition in the table?
The default is (18,0). In VBScript it would be:
pParam1.Precision = 8
pParam1.NumericScale = 2
For C++ it is amazingly similar:
pParam1->Precision = 8;
pParam1->NumericScale = 2;
You have to subsequently set the Precison and NumericScale properties of the parameter object
精彩评论