RunRunWhereQuery Method (XWhere) |
Namespace: Biolomics.BioCallback
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