Quantcast
Channel: SCN: Message List - PowerBuilder Developer Center
Viewing all articles
Browse latest Browse all 7329

Re: passing string variable to select query not working

$
0
0

Your mistake is the logic you use to construct the string used as the query.  As the others have suggested, you should visually inspect the string after building it to see the problem.  You have embedded the word "mid" into your query and not the value contained in the variable named mid (which isn't particularly well-named since "mid" is function name).  In addition, you should not be using double quotes to delimit string in tsql since that will work ONLY if you have a specific and non-default setting.  The code below demonstrates the issue more clearly.

 

string ls_temp, ls_temp2
string mid

mid = "Jones"


ls_temp =  'WHERE (Internal_1 is not null)  and ' &
+ '(feeactive="Y") and mentor="+mid+" ' &
+ 'GROUP BY RollNumber'

 

ls_temp2 =  "WHERE (Internal_1 is not null) and (feeactive='Y') and mentor= '" + &
mid + "' GROUP BY RollNumber"
Messagebox ("test", "#1=" + ls_temp + "~r~n~r~n#2=" + ls_temp2)


Viewing all articles
Browse latest Browse all 7329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>