|
.
.
.
gov.asc.www.ASCQuerySvc svc = new gov.asc.www.ASCQuerySvc();
//query the service to get a list of all available fields.
gov.asc.www.FieldHelper[] AllFields = svc.GetQueryableFields(false);
//load all the available field names into a string list
List<string> FieldNames = new List<string>();
foreach (var curField in AllFields)
{
FieldNames.Add(curField.FieldName);
}
//create a 3 filter condition for St_Abbr, Lic_Number, and Lic_Type. All Operators
//except "Between" and "In" have only one operand
gov.asc.www.FilterCondition oFilter1 = new gov.asc.www.FilterCondition();
oFilter1.FieldName = "St_Abbr";
oFilter1.Operator = gov.asc.www.AvailableOperators.Equals;
oFilter1.Operands = new string[] { "CA" };
gov.asc.www.FilterCondition oFilter2 = new gov.asc.www.FilterCondition();
oFilter2.FieldName = "Lic_Number";
oFilter2.Operator = gov.asc.www.AvailableOperators.Equals;
oFilter2.Operands = new string[] { "AR023287" };
gov.asc.www.FilterCondition oFilter3 = new gov.asc.www.FilterCondition();
oFilter3.FieldName = "Lic_Type";
oFilter3.Operator = gov.asc.www.AvailableOperators.Equals;
oFilter3.Operands = new string[] { "3" };
//run the query and get the results. All available fields will be output. Multiple filter conditions are
//passed in an array, and are logically "ANDed" together. Opt to recieve discipline data and all
//matching records
DataSet oResults = svc.RunQuery(FieldNames.ToArray(), new gov.asc.www.FilterCondition[] { oFilter1, oFilter2, oFilter3 }, true, 0);
//display all the returned column titles
for (int i = 0; i < oResults.Tables[0].Columns.Count; i++)
{
Console.Write(oResults.Tables[0].Columns[i].ColumnName + "\t");
}
Console.WriteLine();
//iterate the result set and display it
foreach (DataRow oRow in oResults.Tables[0].Rows)
{
for (int i = 0; i < oResults.Tables[0].Columns.Count; i++)
{
Console.Write(oRow[i].ToString() + '\t');
}
Console.WriteLine();
}
svc.Dispose();
.
.
.
|