Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
API, SDK, REST and Web Services
SQL result not the same with CAPI.exec
Anquoc_Tran
HiI am trying to execute a simple sql statement and the returned values are not the same from Livelink.Table tblABC has two columns (id, Name) with values '123', 'John'If I execute the below query, then I get the result as "John"select Name from tblABC where id = '123'but the Livelink returns some different values. Any suggestions ?Dynamic retValString sqlstmt = select Name from tblABC where id = '123'retVal = CAPI.exec (dbConnection, sqlstmt)Output is: {<'Name'><'John '>}Thanks
Find more posts tagged with
Comments
Appu_Nair
CAPI.EXEC could give you all the results in a array called RecArray ,it could be a error also.so typically to get the output of a statement you need to use the right iterator.A simple example of your code will be,I included a little binding so that your code is not susceptible for sql injection.*********Try this and see if it works*******String stmt = "select Name from tblABC where id =:A1"Dynamic err = CAPI.Exec( dbconnection, stmt, '123' )Assoc retValretVal.OK = TrueDynamic eachRowInRecArray// If we got an error try to see what the error is if IsError( err ) retVal.OK = false retVal.ErrMsg = Error.ErrorToString( err ) else //we know that we got something so try to show stuff for eachRowInRecArray in err echo(eachRowInRecArray) echo("Name is:"+eachRowInReCArray.Name) echo("user string functions if output is other than string") end end//use retVal assoc to send the calling function useful info
Appu_Nair
sorry too much garbage in posting hence the code snippet
Anquoc_Tran
Many Thanks Appu. It works fine now. You are the star.