Click or drag to resize
RunRunWhereQuery Method (XWhere)
Runs the XWhere query in the current search page .

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static int RunWhereQuery(
	XWhere p_Where
)

Parameters

p_Where
Type: Biolomics.SharedClassesXWhere
The XWhere to be used to run the query.

Return Value

Type: Int32
Error code.
Examples
The following code will run a query straight in the current search page of BioloMICS. So open at least one Search Page, and try to view many records in its BioSheet.
Example VB.Net
Imports System
Imports BioloMICS.BioCallback
Imports BioloMICS.SharedClasses
Imports System.Collections
Imports Biolomics.Utility.DatabaseConstants
Imports Biolomics.BaseLibrary

Public Class Program

    <STAThread()>
    Shared Sub Main()
        '    Create an instance of class Program and call its functions
        Dim c As New Program
        'run where query
        'c.RunQuery()
        'run mysql query
        'c.RunMysqlQuery
        'run ReadQuery
        c.ReadQuery()

    End Sub

    '    *****    Run a ReadQuery    in the stocks table    *****
    Public Sub ReadQuery()

        Dim m_SqlCo As XConnection = run.GetCurrentConnection()
        Dim query As XQuery = XQuery.Select_(StaticFields.id & "," & StaticFields.name).From("sm_stocks_").Where(StaticFields.id, XWhere.OperationEnum.LT, 25)
        Using database As ParentDatabase = m_SqlCo.Connect(True), reader As BaseDataReader = Run.ReadQuery(database, query, True)
            If reader.ErrorCode() = 0 Then
                While reader.Read()
                    Dim id As Integer = reader.GetInt32(StaticFields.id)
                    Dim name As String = reader.GetString(StaticFields.name)
                    Console.WriteLine("record " & id & " : " & name)
                End While
            End If
        End Using

    End Sub

    '    *****    Run a query    in the current SearchPage    *****
    Public Sub RunQuery()
        Dim Where As XWhere = XWhere.GT(StaticFields.id, 2).And_(StaticFields.id, XWhere.OperationEnum.LT, 8).Or_(StaticFields.name, XWhere.OperationEnum.EndWith, "877")
        Dim ErrorCode As Integer = Run.RunWhereQuery(Where)
        If ErrorCode = 0 Then
            Console.Write("No Error")
        Else
            DrawMessages()
        End If

    End Sub

    Public Sub RunMysqlQuery()
        Dim Where As String = " _id < 3 "
        Dim ErrorCode As Integer = Run.RunWhereQuery(Where)
        If ErrorCode = 0 Then
            Console.Write("No Error")
        Else
            DrawMessages()
        End If

    End Sub

    '    display all recent error messages
    Public Sub DrawMessages()
        Dim ErrorList As Generic.List(Of String) = Run.GetLastErrorMessage()
        For Each errorMsg As String In ErrorList
            Console.Write(vbcrlf & errorMsg)
        Next
    End Sub

End Class
See Also