How to use the K2 ADO.NET Data Provider SerialNumber Parameter

  • 24 February 2022
  • 0 replies
  • 5 views

Userlevel 3
Badge +8
 

How to use the K2 ADO.NET Data Provider SerialNumber Parameter

KB000191

PRODUCT
K2 blackpearl
TAGS
Data Handling
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

 

Introduction

The ADO.NET provider plays an integral role in the K2 platform. It provides developers with many levels of customization options, at both the process and user interaction levels.
Note: This document assumes some programming knowledge and familiarity with ASP.NET and the K2 API.

 

 

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.  

 


0 replies

Be the first to reply!

Reply