Question
Vivek Nayak · Sep 17, 2019

##class(%SQL.Statement).%ExecDirect() method not work

Hi Team,

When I use below statement , I got SQLCODE=0.

SET rs = ##class(%SQL.Statement).%ExecDirect(, "SELECT * FROM LISDB.ExternalUsers WHERE UserId = 83")

If I display above query using   Write (rs.%Display())  it gives me below result but   (rs.%Get("Prefix")) method give me null value.

Please help

00
0 1 122 1

Replies

Maybe the "Next" method is missing.

Ex:

SET rs = ##class(%SQL.Statement).%ExecDirect(, "SELECT * FROM LISDB.ExternalUsers WHERE UserId = 83")

do rs.%Next()

write rs.%Get("Prefix")

If that doesn't work, put the command sequence you're running.