Search code examples
powerbuilder

Can i pass a integer argument to DW.Table.Select


I have stored procedure which requires two string and an integer argument to execute. I'm trying to execute the stored procedure by

MySQLString="DataWindow.Table.Select=~"CALL MYPROC('" + strarg1+ '",  "' + intarg + "' ,'"  + strarg2+"')~""                 
dw_1.Modify(lsSQLString)
dw_1.Retrieve()

This is throwing a compile error like Incompatible types in expression: string, integer

Can anyone explain if DataWindow.Table.Select will support passing integer arguments like intarg above?


Solution

  • If strarg1 and strarg2 are both of string type, and intarg is an integer, you cannot concatenate them with + to make the string MySQLString.

    That's what the compiler is trying to tell you with

    Incompatible types in expression: string, integer

    You have to convert the integer in string with string(intarg) :

    MySQLString="DataWindow.Table.Select=~"CALL MYPROC('" + strarg1+ '",  "' + string(intarg) + "' ,'"  + strarg2+"')~""