﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Problem with searching on a varchar(2) field...</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 10:41:08 GMT</lastBuildDate><ttl>20</ttl><item><title>Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13193.aspx</link><description>I have a table with a varchar(2) field in it.&amp;nbsp; While checking out a problem that exhibited when using the Contains on a BrowseDialog of the table, I noticed that the query was putting in '%I' instead of '%I%' when searching for Contains with a 'I'.&amp;nbsp; I figured this was due to the varchar(2) field. &lt;/P&gt;&lt;P&gt;Do you think the easiest way to handle this would be to simply switch that field to a varchar(4), so that it could properly add '%' to the search parameter value ?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Robin Giltner</description><pubDate>Thu, 17 Jan 2008 16:04:52 GMT</pubDate><dc:creator>Robin J Giltner</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13554.aspx</link><description>You're very welcome...thanks for all of your help as well!</description><pubDate>Thu, 17 Jan 2008 16:04:52 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13549.aspx</link><description>Thanks from me too guys.</description><pubDate>Thu, 17 Jan 2008 14:56:34 GMT</pubDate><dc:creator>Robin J Giltner</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13541.aspx</link><description>Thank you very much, sir :)</description><pubDate>Thu, 17 Jan 2008 14:32:21 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13535.aspx</link><description>You guys are the greatest. Thanks for the very prompt reply and fix. Just another reason supporting our decision for using this framework.</description><pubDate>Thu, 17 Jan 2008 14:18:02 GMT</pubDate><dc:creator>Kenneth Langley</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13533.aspx</link><description>Good. I thought that this might fix it.&amp;nbsp; I will go ahead and make the change to the framework source so it will be included in the future.&amp;nbsp; Sorry I was is such a rush...but things are crazy around here today :)</description><pubDate>Thu, 17 Jan 2008 14:11:07 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13531.aspx</link><description>After making the changes you mentioned in the SqlDataSourceItem Class, method CreateDBParameter.&amp;nbsp;&amp;nbsp; I changed line 1006 from&lt;P&gt;[codesnippet]&lt;/P&gt;&lt;FONT color=#008000 size=2&gt;&lt;P&gt;'-- Set the size on the parameter&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;loReturn.Size = QueryInfo.FieldLengths(FieldName)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;/P&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/FONT&gt;&lt;FONT size=2&gt; QueryInfo.FieldLengths(FieldName) &amp;gt; 0 &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Then&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'-- Set the size on the parameter + 2&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;loReturn.Size = QueryInfo.FieldLengths(FieldName) + 2&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;Else&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;'-- Set the size on the parameter&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;P&gt;loReturn.Size = QueryInfo.FieldLengths(FieldName)&lt;/P&gt;&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;End&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;If&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;[/codesnippet]&lt;/P&gt;&lt;P&gt;And this seems to have fixed our problem of using all possible characters on a Contains search in the BrowseDialog.&lt;/P&gt;&lt;P&gt;Thank you guys.</description><pubDate>Thu, 17 Jan 2008 14:02:26 GMT</pubDate><dc:creator>Kenneth Langley</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13522.aspx</link><description>When I use a field that is a a varchar(44) in the database. If I include say only 2 or three letters in the search, the query looks like&lt;P&gt;[codesnippet]&lt;/P&gt;&lt;P&gt;exec sp_executesql N'SELECT TOP 1000 [countryPK], [ccode], [ccountry] FROM [dbo].[countrycode] WHERE [ccountry] LIKE @PARAM0;&lt;/P&gt;&lt;P&gt;',N'@PARAM0 varchar(44)',@PARAM0='%Andorra%'&lt;/P&gt;&lt;P&gt;&amp;nbsp;[/codesnippet]&lt;BR&gt;&lt;/P&gt;&lt;P&gt;But, lets say I use 44 characters in my search (same field) the query looks like&lt;/P&gt;&lt;P&gt;[codesnippet]&lt;/P&gt;&lt;P&gt;exec sp_executesql N'SELECT TOP 1000 [countryPK], [ccode], [ccountry] FROM [dbo].[countrycode] WHERE [ccountry] LIKE @PARAM0;&lt;/P&gt;&lt;P&gt;',N'@PARAM0 varchar(44)',@PARAM0='%Andfghjyuilopoiujhgfrtyuioplkijuhytredswqas'&lt;/P&gt;&lt;P&gt;[/codesnippet]&lt;BR&gt;&lt;/P&gt;&lt;P&gt;These are both using contains on the form.&lt;/P&gt;&lt;P&gt;This is the case on another table with a varchar(7) field.&amp;nbsp; If you use all 7 characters for a search (Z155326) it puts in the query @PARAM0=’%Z15532’&lt;/P&gt;&lt;P&gt;And leaves off the last character, and thus no results are returned, because our table doesn’t have any items ending in Z15532, it has an item starting with Z15532 (Z155326).&lt;/P&gt;&lt;P&gt;I hope this makes sense.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Also Robin Giltner's forum account is unable to post to the forum. Any help would be appreciated.&lt;BR&gt;</description><pubDate>Thu, 17 Jan 2008 13:19:50 GMT</pubDate><dc:creator>Kenneth Langley</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13521.aspx</link><description>test</description><pubDate>Thu, 17 Jan 2008 13:15:40 GMT</pubDate><dc:creator>Kenneth Langley</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13512.aspx</link><description>The SqlDataSourceItem is configured to do this:&lt;/P&gt;&lt;FONT size=1&gt;&lt;P&gt;loParam.Value = &lt;/FONT&gt;&lt;FONT color=#e10000 size=1&gt;"%"&lt;/FONT&gt;&lt;FONT size=1&gt; &amp;amp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=1&gt;CType&lt;/FONT&gt;&lt;FONT size=1&gt;(loWhere.Values(0), &lt;/FONT&gt;&lt;FONT color=#0000ff size=1&gt;String&lt;/FONT&gt;&lt;FONT size=1&gt;) &amp;amp; &lt;/FONT&gt;&lt;FONT color=#e10000 size=1&gt;"%"&lt;/P&gt;&lt;/FONT&gt;&lt;P&gt;when you use Contains... something else is amiss...</description><pubDate>Thu, 17 Jan 2008 09:10:14 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13511.aspx</link><description>Are you using the SqlDataSourceItem?</description><pubDate>Thu, 17 Jan 2008 09:07:58 GMT</pubDate><dc:creator>StrataFrame Team</dc:creator></item><item><title>RE: Problem with searching on a varchar(2) field...</title><link>http://forum.strataframe.net/FindPost13508.aspx</link><description>This occurs for varchar(7) fields also if you search with contains.</description><pubDate>Thu, 17 Jan 2008 08:09:37 GMT</pubDate><dc:creator>Kenneth Langley</dc:creator></item></channel></rss>