How to determine the size of the command parameters MSADO

I am new to MS ADO and trying to understand how to set the size according to the parameters of the command created using

command.CreateParameter (Name, Type, Direction, Size, Value)

The documentation states the following:

Size - Optional. A long value that defines the maximum length for a parameter value in characters or bytes.

...

If you specify variable-length data, enter a type argument, you must either pass the Size argument, or set the Size Property of the Parameter object before adding it to the collection parameters; otherwise, an error occurs.

1.) What is needed for fixed-size parameters? Is it "not worried"?

, , 3 adInteger , VT_I2

pPrmByRoyalty->Type = adInteger;
pPrmByRoyalty->Size = 3;
pPrmByRoyalty->Direction = adParamInput;
pPrmByRoyalty->Value = vtroyal;

VT_I2 . tagVARIANT - 16 . ? , enum adInteger , , .

, . , , sizeof (int) adInteger , , . ?

, : " .. ".

2.) adVarChar , ?

3.) (, adVarWChar)? ?

4.) adVariant, ?

5). ? ( , )

.

+3
1

1) , vtMissing (comutil.h). BTW, ( SQL Server) adInteger 4, VT_I4, VT_I2 - 2 adSmallInt.

2) , . , , - , . , , , , , .

3) , .

4 5 , adVariant .

+1

Source: https://habr.com/ru/post/1747412/


All Articles