FlowFact - Entwicklungstools v19.881 FLOWFACT 2017 R2 - Function - Sql_GetDSN

DSN abfragen

Diese Funktion liefert die erste DSN der Ergebnismenge.
Function Sql_GetDSN(ByVal strTable As String, ByVal strWhere As String, Optional ByVal strOderBy As String = "") As String


strTable: Tabellenname
strWhere: WHERE-Teil einer SELECT-Abfrage (ohne WHERE!)
strOderBy: ORDER BY-Teil einer SELECT-Abfrage (ohne ORDER BY!)
Rückgabewert: Recordset; siehe AdoHelp\ADO210.CHM


Public Function Sql_GetDSN(ByVal strTable As String, ByVal strWhere As String, Optional ByVal strOderBy As String = "") As String
    Dim strSQL As String
    Dim rs As ADODB.Recordset

    strSQL = ""
    If Trim(strWhere) <> "" Then
        strSQL = strSQL & " WHERE " & strWhere
    End If
    If Trim(strOderBy) <> "" Then
        strSQL = strSQL & " ORDER BY " & strOderBy
    End If

    Set rs = FF_GetRecordset("SELECT Dsn FROM " & strTable & " " & strSQL)

    If rs.EOF = False Then
        Sql_GetDSN = rs("Dsn").value
    Else
        Sql_GetDSN = ""
    End If
End Function