Query Database

API Type

Web Services

Description

Queries the database with any valid sql query and returns the dataset as a string in XML format.

Syntax

public virtual string QueryDatabase(string sql)

Parameters

Name Description

sql

Definition:
The where clause of the SQL statement you want to query.
Type
string
Allowed Values:
The where clause of a SQL statement.

Output

An XML string that contains the dataset with the results of the database query.

Example

IWFWorkflowService svc = GetWorkflowService();
string sql = "SELECT * FROM WF_AUDIT_TRAILS where CATEGORY = 0 AND
PURPOSE='Check-in process definition'";

try
	{
    // calling the QueryDatabase web method and passing the sql query as the argument.
    string xml = svc.QueryDatabase(sql);
    Console.WriteLine("{0}", xml);// Displaying the XML string on console.
    System.IO.stringReader sr = new System.IO.stringBuilder(xml);
    System.Data.DataSet ds = new System.Data.DataSet();
    ds.LoadXml(sr);
	}

catch (Exception ex)
	{
    Console.WriteLine("Failed! " + ShUtil.GetSoapMessage(ex));
	}

Supported Versions

3.2.0.4 and higher