JDBC like clause not working
Last Post 13 Dec 2012 12:12 PM by GERALD MAGNUSON. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
GERALD MAGNUSON
New Member
New Member
Posts:24

--
13 Dec 2012 10:22 AM

when I :

SELECT dbo.DocPub.Name
From dbo.DocPub
Where dbo.DocPub.Name =  '37345840'


I do get 1 record returned, but when I change the "=" to a LIKE :

SELECT dbo.DocPub.Name
From dbo.DocPub
Where dbo.DocPub.Name LIKE '3734584%'

I do not get any returned (should have 6 records...)

code:

prepstm = JDBC_prepStmt(conn:'SELECT dbo.DocPub.Name  '
    'FROM  dbo.DocPub '  +                              
    'WHERE dbo.DocPub.Name LIKE ? ') ;                  
                                                        
 if (prepstm = *NULL);                                  
   jdbc_close(conn);                                    
   return;                                              
 endif;                                                 
 DrawString =  appost + '3734584%' + appost ;               
 JDBC_SetString(prepstm:1:DrawString) ;                 
                                                        
                                                         
 rs = jdbc_ExecPrepQry(prepstm);

x = 0 ;                                     
DoW jdbc_nextRow(rs);                         
  x += 1 ;

dwgarr(x) = jdbc_getColByName(rs:'Name') ;  

                                 
EndDO;



GERALD MAGNUSON
New Member
New Member
Posts:24

--
13 Dec 2012 12:12 PM

ok, I got it working....

I found it on a different board:


JDBC_SetString(prepstm:1:'%' + %trim(DrawString) +
                  '%') ;

I guess I wasn't escaping the percent sign properly....




You are not authorized to post a reply.

Acceptable Use Policy