QueryTurnaround

QueryTurnaround.asmx

This web service lets the user execute the SQL query.

 

ExecuteQuery

Usage:

ExecuteQueryResult = A.ExecuteQuery(UserName, UserPassword, query, numberOfRecords)

Parameters UserName and UserPassword are not used at this moment.

 

Input Parameters

Parameter

Type

Detail

query

String

System will automatically add “SELECT ” to the query string. For example, if user wants to execute SQL command “SELECT ORDER_NO FROM CPORDHDR,” he/she needs to set this query string as “ORDER_NO FROM CPORDHDR.”

numberOfRecords

String

Maximum number of returned records.

 

ExecuteQueryResult Structure

Property Name

Type

Detail

ReturnCode

Integer

0 = OK

10001 = missing query

Data

DataSet

Contains a data table (table name “Data”). The rows in data table depends on your query.

 

Code Example

The following sample code will make an order inquiry.

 

Dim Service As New webServicesQueryTurnaround.QueryTurnaround()

Dim Result As New webServicesQueryTurnaround.ExecuteQueryResult

Dim query As String = “ORDER_NO, ORDER-DATE, ORDER-TYPE, ORDER-SHIP-TO-NO FROM CPORDHDR WHERE ORDER_NO > 112487 AND ORDER_NO < 115877”

Dim numberOfRecords As String = “999”

Result = Service.ExecuteQuery(“”, “”, query, numberOfRecords)

If Result.ReturnCode = 0 Then

  If Result.Data.Tables(0).Rows.Count > 0 Then

     lblResult.Text = “First Matching Order No. is” & _

      Result.Data.Tables(0).Rows(0).Item("ORDER_NO")

  Else

     lblResult.Text = “No Matching Order.”

  End If

Else

  lblResult.Text = “Error”

  lblErrorCode.Text = Result.ReturnCode.ToString

End If

Feedback and Knowledge Base