by Beth » Wed 23. May 2018 11:42:27
Hello,
Yes Thank you I did it in the script and it works. I can retrieve a value. The problem I am having now is how to retrieve a row with multiple items and visualize each one of them separately. I can get each one of them in the script but the output of the method is just one variant and I don't know how to pass multiple values to it.
Here is the script :
Dim oAdo, oRs, sSQL, bRes, Value1, Value2, Value3
Set oAdo = pMe.Pm("../PmAdo")
sSQL = "select * from myTable where Time = (select max(Time) from myTable )"
'open the database, if not open
If Not oAdo.DbIsOpen() Then
bRes = oAdo.DbOpen()
Else
bRes = true
End If
'if the database is open, then continue
If bRes Then
'opening the corresponding table
Set oRs = oAdo.RsOpen("", sSQL, "")
'checking whether the opening operation was comleted successfully
If Pm.IsValid(oRs) Then
'checking whether the table is not empty
If oRs.EOF And oRs.BOF Then
'Pm.Debug "Table (recordset) contains no records"
pResult = -1
Else
'if the table is not empty then it can be read as a 2-dimensional array
Value1 = oRs.Fields.Item("I1").Value
Value2 = oRs.Fields.Item("I2").Value
Value3 = oRs.Fields.Item("I3").Value
pResult = Value1
End If
Else
'Pm.Debug "Table opening error"
pResult = -1
End If
Else
'Pm.Debug "Database opening error"
pResult = -1
End If
Can you please show me how to do it ?
Thank you