RunGetCurrentConnection Method |
Namespace: Biolomics.BioCallback
Imports System Imports BioloMICS.BioCallback Imports BioloMICS.SharedClasses Public Class Program <STAThread()> Shared Sub Main() ' Create an instance of class Program and call its functions Dim c As New Program c.AddAndDeleteRecords() End Sub ' Write sub functions here Public Sub AddAndDeleteRecords() ' get the current connection Dim SqlCo As XConnection = Run.GetCurrentConnection() If SqlCo Is Nothing Then Return End If ' get the current layout Dim Layout As XDataLayout = Run.GetCurrentLayout() If Layout Is Nothing Then ' no current layout in a search page Return End If ' get the current table Dim TableDef As XTableDef = SqlCo.GetTableDef(Layout.TableKey) If TableDef Is Nothing Then ' should never happen Return End If ' add two records. If RecordId1 < 0: there is an error Dim RecordId1 As Integer = Run.AddRecord(TableDef.UserName, "New Record 1") Dim RecordId2 As Integer = Run.AddRecord(TableDef.UserName, "New Record 2") ' delete the second record Run.DeleteRecord(TableDef.UserName, RecordId2) End Sub End Class