Last post Mar 07, 2011 04:05 PM by coredev
Feb 16, 2011 03:39 PM|rpfinnimore|LINK
I have a query being used to load a gridview from a view in db2 on an iseries server. When I use the syntax
select field1, field2 from tablename where field2 like ? there is no problem the query returns the resultset where field2 exactly matches the parameter.
Having problems figuring out or finding on the net how to introduce wild card to the parameter...have tried all kinds of things such as
select field1, field2 from tablename where field2 like %?% and
select field1, field2 from tablename where field2 like '%'+?+'%'
but everything I try just
raises exceptions. Can some kind soul give me an example of the proper syntax? Thanks much in advance, Roscoe
Mar 05, 2011 08:38 AM|coredev|LINK
Have you tried using select field1, field2 from tablename where field2 like '%?%'
What kind of dataaccess code are you using, could you provide an example?
Mar 07, 2011 03:57 PM|rpfinnimore|LINK
Yes I did try that with the same result. I got around the issue by appending the wildcards to the search string in the code behind of the calling .aspx and just refering to the variable in the sql as ? ...a bit bogus but it works.
The database is DB2 running on an iseries server. I'm thinking that the issue has to do with how sql is configured on the iseries rather than any issue with aspx.
Thanks for the Reply,
Mar 07, 2011 04:05 PM|coredev|LINK
Ok good that you got it to work! DB2 and iSeries are on of my favourites, I started as a developer on an AS400 with RPG and DB2 :-)