SQL in web invoked agent not returning any data?

HI,I have an agent that runs when a button on the web gets clicked. The agent connects to a db2 db - it works. Than it is supposed to execute an sql - it doesn’t work. It actually says it executed with no error but comes back with no data even I know and tested this otherwise that data is in the db. Anyone can help to point out what am I doing incorrectly?

Thanks for any help

Andrej

Here is some of my code.

Set doc = session.DocumentContext

Call MyConnectToDB2 ( “ENDCDSNU”, doc.uId(0), doc.PW(0))

sql = |select po_id from bdw3.Purchase_ord where PO_id = ‘5000789789’|

MySQL1(sql)

If result.NumRows = -1 Then

Print |No details about this PO


| & sql

Else

Print |No. of rows returned = | & result.NumRows

End If

…it always comes back as -1

Subject: SQL in web invoked agent not returning any data???

Andrej,

You did not include your function MySQL1() --the crucial part of your code that issues the SQL statement, so that makes it hard to help.

My advice is to run the agent from the Designer client with the LotusScript Debugger turned on and step through your code to make sure it works on the client before you try to determine if it is a web issue. Since “doc” will have no value when the agent is run on the client, you will have to hardcode its values in order to test.

Another thing, I have found that if too much data (i.e., too many records) are returned by your SQL query, nothing will display on the web since you will have gone beyond the limits of what can be stored in a field – at least a text field anyway (32 KB limit).

Ken

Subject: RE: SQL in web invoked agent not returning any data???

I just noticed that the result has data in it when I do result.FirstRow

So my code works!!! What surprices me is why result.NumRows returns -1. Bit of a mistery. I am only expeting to see couple lines. Anyway I can get my data now.