FlowFact - Entwicklungstools

zurück

Function - Sql_Find
Tabelle abfragen

Diese Funktion liefert den Inhalt eines Datensatz in einem Recordset zurück.
  Function Sql_Find(ByVal strTable As String, ByVal strWhere As String, Optional ByVal strOderBy As String = "") As ADODB.Recordset  
 


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_Find(ByVal strTable As String, ByVal strWhere As String, Optional ByVal strOderBy As String = "") As ADODB.Recordset
    Dim strSQL As String

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

    Set Sql_Find = FF_GetRecordset("SELECT * FROM " & strTable & " " & strSQL)
End Function