Utilizzo di Ado in VB6

Private Function ExistInCalendar(ByVal strNomeTabella As String, ByVal curIDTabella As Long, ByRef idCalendarEvent As Long)

    Dim rstData     As ADODB.Recordset
    Dim strSQL      As String
    Dim blnResult   As Boolean
    
    On Error GoTo errHandler
    
    blnResult = False
    idCalendarEvent = 0
    
    strSQL = "Select IsNull(EventID, 0) As EventID "
    strSQL = strSQL & " From CalendarApp "
    strSQL = strSQL & " Where Tabella = " & Quote(strNomeTabella)
    strSQL = strSQL & "   And IDTabella = " & curIDTabella
    
    Set rstData = New ADODB.Recordset
    rstData.Open strSQL, gobjSessione.Connection, adOpenForwardOnly, adLockReadOnly
    If Not (rstData.EOF And rstData.BOF) Then
        idCalendarEvent = SafeCLng(rstData.Fields("EventID").Value, 0)
        blnResult = True
    End If
    
Terminate:
    On Error Resume Next
    Set rstData = Nothing
    ExistInCalendar = blnResult
    Exit Function

errHandler:
    Debug.Assert False
    Resume Terminate
    Resume

End Function

Torna su
Categoria

Visual Basic 6 (991)


Autore

Marco Cecchetti


Data pubblicazione.

02/04/2021



Recensioni

Articolo non ancora recensito