Starting a K2 process in an ADO.NET Application
Either a SQLDataSource or an ObjectDataSource can be used to create the connection to the process. Select the New Connection button to configure the connection. When selecting a SmartObject to provide the data in the Add Connection window browse to the Workflow folder and select the required K2 process.
Fig. 1. Example of a K2 workflow process surfaced as a SmartObject

Fig. 2. K2 workflow SmartObject available as a Stored Procedure
It is important to select the correct SmartObject property for each of the SQL statements to ensure the correct action is performed on the K2 server. For Example:
- The [Investment_Investment_Approval_Manager_Approval.LoadWorklistItem] will be selected for the SELECT tab enabling the data to be returned from the server.
- The [Investment_Investment.StartProcess] will be selected for the INSERT tab enabling the data to be returned from the server.
- The [Investment_Investment_Approval_Manager_Approval.Approved] can be selected under the UPDATE tab to update the K2 server.
Link a K2 process to a SmartObject Method
The workflow SmartObject properties can be surfaced in other SmartObject' s methods (Example A) or even created as a SmartObject Method (Example B). This allows a developer to create a SmartObject Method that will start a process in the form.
Example A: The process will be started automatically as soon as the SmartObject is created as the K2 workflow has been linked to the SmartObject's existing Create Method. If the Create method is selected in the data provider as the INSERT Stored procedure it will result in the workflow firing as soon as the SmartObject is created through the ADO.NET form.

Fig. 3. Create a Start SmartObject Method
Example B: A SmartObject Method can be created to start the process. The Method will surface in the data source and can be assigned to the ADO.NET form.

Fig. 4. Create a Start SmartObject Method