///this function is used to get the Record from the Database and display the result
Public Function fnGetRecord(strSQL,strConnectionString)
fnGetRecord=false
Dim dBRecSet,dBConnection
'Set the Database connection object
Set dBConnection=fnDBOpenConnection(strConnectionString)
'Verify for object exist or not
If isobject(dBConnection) Then
'Execute the SQL and get the recordset object
On error resume next
Set dBRecSet= dBConnection.execute(strSQL)
'Verify for the record set has reached EOF or not
If dBRecSet.EOF=false Then
blnResult=fnDisplayResult(dBRecSet,"dbo.fpac_acct_hedgeoverlay")
If blnResult Then
'return the recordset object back
'Set fnGetRecord=dBRecSet
fnGetRecord=true
End IF
'Check for the error number
If not err.number = 0 then
'fnInsertResult "Database Verification", "Verifying the Record from Database", "Error in either Table name or column name", "WARNING"
Reporter.ReportEvent micWarining, "Verifying the Record from Database", "Error in either Table name or column name"
fnGetRecord=false
Exit function
End If
On error goto 0
Else
'fnInsertResult "Database Verification", "Verifying the Record from Database", "No Record exist", "FAIL"
Reporter.ReportEvent micFail, "Verifying the Record from Database", "No Record Exist"
'Verify for the record set has reached EOF or not
End If
Else
fnGetRecord=false
'Verify for object exist or not
End If
'reinitialize the object to null
Set dBConnection=nothing
Set dBRecSet=nothing
End Function
''This function is used to display result from the record set object
Public function fnDisplayResult(dBRecSet,strTableName)
fnDisplayResult=false
Dim intLoop
If isobject(dBRecSet) Then
If dBRecSet.EOF = false Then
Do While Not dBRecSet.eof
For each intLoop in dBRecSet.fields
'fnInsertResult "Records form the database for Table Name"&strTableName, "Verifying the value for columns "&intLoop.name, " Value is : "&intLoop.value, "PASS"
Reporter.ReportEvent micPass, "Verifying the value for columns '"&intLoop.name&"' in Table '"&strTableName & "'", " Value is : '" &intLoop.value &"'"
fnDisplayResult=true
next
dBRecSet.MoveNext
Loop
Else
'fnInsertResult "Database Verification", "Verifying the Record from Database", "No Record exist", "FAIL"
Reporter.ReportEvent micFail, "Verifying the Record from Database", "No Record Exist"
End If
End If
Set dBRecSet = nothing
End Function
No comments:
Post a Comment