Click or drag to resize
RunDeleteRecord Method
Deletes the record from given table.

Namespace:  Biolomics.BioCallback
Assembly:  Biolomics.BioCallback (in Biolomics.BioCallback.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static int DeleteRecord(
	string p_TableName,
	int p_RecordId
)

Parameters

p_TableName
Type: SystemString
The table name.
p_RecordId
Type: SystemInt32
The record id.

Return Value

Type: Int32
Error code.
Examples
This is an example of use of DeleteRecord to delete record from table.
Example VB.Net
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
See Also