Using the Serial Number Parameter
When using the ADO.NET provider to list the Actions from a Worklist item surfaced in an ASP.NET page, a Serial Number parameter is used for identification purposes.
An error will be returned if the developer adds a parameter called SerialNumber in order to list all the Actions corresponding to a specific Serial Number. The SQL data source already has a parameter named SerialNumber. The second declared SerialNumber parameter has a null value, therefore no values will be returned.
The following code demonstrates this condition:
string SN = Request.QueryString["SN"].ToString();
Parameter param = new Parameter("SerialNumber", TypeCode.String, SN);
soSqlLoad.SelectParameters.Add(param);
DataView dv = (DataView)soSqlLoad.Select(DataSourceSelectArguments.Empty); //would return null
As the SQL data source already contains the SerialNumber parameter, adding another parameter is unnecessary. Instead the SerialNumber parameter of the SQL data source can be loaded with the required Serial Number and used to return the corresponding Worklist Actions.
Example
The following code demonstrates the solution:
string SN = Request.QueryString["SN"].ToString();
soSqlLoad.SelectParameters["SerialNumber"].DefaultValue = SN;
DataView dv = (DataView)soSqlLoad.Select(DataSourceSelectArguments.Empty);
In this example, the serial number is retrieved from the ASP.NET request and then used to set the
SerialNumber parameter of the SQL query.