Public Function GetValue(FiledName As String, TableName As String, WhereClause As String) As String
Dim strSQL As String
Dim ConnectFR As ADODB.Connection
Dim rsValue As ADODB.Recordset
Set ConnectFR = ConFR.OpenConnection
If FiledName <> "" And TableName <> "" And WhereClause <> "" Then
strSQL = "Select " & FiledName & " From " & TableName & " Where " & WhereClause & ";"
Set rsValue = New ADODB.Recordset
rsValue.Open strSQL, ConnectFR, adOpenStatic, adLockOptimistic
If rsValue.BOF = False And rsValue.EOF = False Then
GetValue = rsValue(0).Value & ""
Else
GetValue = ""
End If
Else
GetValue = ""
End If
ConFR.CloseConnection
Set ConnectFR = Nothing
End Function
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment