Query Application Block - output direction parameter error ??

Feb 10, 2010 at 7:10 AM

I'm using QAB in EL 4.1.

I set a parameter that has string in DbType and output in Direction.

But the parameter returned just one charcter.

for example, if return value is 'success' then output parameter value is just 's'.

Of course i set the parame type as 'varchar(10) out' in procedure.

Am I wrong or is there something error?


Feb 12, 2010 at 6:05 PM
Edited Feb 12, 2010 at 6:07 PM

Hi Elvagood,

Firstly, thank you for spotting this bug and documenting it.  It took me a bit to find, but at last I have found the problem and fixed it.  The QAB uses the DAAB for Data queries and this issue stems from the differences in the general AddParameter() method within the DAAB for input and output parameters. By default the size parameter is set to 0 which oddly results in a single character returned for an output parameter.  The DAAB has an extra AddOutParameter() method that takes a size parameter to get around this problem.  For Output parameters I have now set the size to int.MaxValue so this should cover all eventualities. You probably know this already, but the ParameterDictionary inside the Data query is updated with any output parameter values from an ExecuteForRead command. so if your query instance is called "query" then after an ExecuteForRead command you can get the parameter values from "query.ParameterSet.Parameters[{parameter name}].Value".

The fix has been uploaded to the latest source code. For your interest only the "Query.Database.dll" is affected.

Cheers...   Steve