Problem with searching on a varchar(2) field...


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You're very welcome...thanks for all of your help as well!
Robin J Giltner
Robin J Giltner
StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)StrataFrame User (179 reputation)
Group: Forum Members
Posts: 105, Visits: 650
Thanks from me too guys.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Thank you very much, sir Smile
Kenneth Langley
Kenneth Langley
StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 1.5K
You guys are the greatest. Thanks for the very prompt reply and fix. Just another reason supporting our decision for using this framework.
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Good. I thought that this might fix it.  I will go ahead and make the change to the framework source so it will be included in the future.  Sorry I was is such a rush...but things are crazy around here today Smile
Kenneth Langley
Kenneth Langley
StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 1.5K
After making the changes you mentioned in the SqlDataSourceItem Class, method CreateDBParameter.   I changed line 1006 from

'-- Set the size on the parameter

loReturn.Size = QueryInfo.FieldLengths(FieldName)

to

If QueryInfo.FieldLengths(FieldName) > 0 Then

'-- Set the size on the parameter + 2

loReturn.Size = QueryInfo.FieldLengths(FieldName) + 2

Else

'-- Set the size on the parameter

loReturn.Size = QueryInfo.FieldLengths(FieldName)

End If

And this seems to have fixed our problem of using all possible characters on a Contains search in the BrowseDialog.

Thank you guys.

Kenneth Langley
Kenneth Langley
StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 1.5K
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

exec sp_executesql N'SELECT TOP 1000 [countryPK], [ccode], [ccountry] FROM [dbo].[countrycode] WHERE [ccountry] LIKE @PARAM0;

',N'@PARAM0 varchar(44)',@PARAM0='%Andorra%'

 


But, lets say I use 44 characters in my search (same field) the query looks like

exec sp_executesql N'SELECT TOP 1000 [countryPK], [ccode], [ccountry] FROM [dbo].[countrycode] WHERE [ccountry] LIKE @PARAM0;

',N'@PARAM0 varchar(44)',@PARAM0='%Andfghjyuilopoiujhgfrtyuioplkijuhytredswqas'


These are both using contains on the form.

This is the case on another table with a varchar(7) field.  If you use all 7 characters for a search (Z155326) it puts in the query @PARAM0=’%Z15532’

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).

I hope this makes sense.

Thanks.

Also Robin Giltner's forum account is unable to post to the forum. Any help would be appreciated.

Kenneth Langley
Kenneth Langley
StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)StrataFrame Novice (84 reputation)
Group: StrataFrame Users
Posts: 26, Visits: 1.5K
test
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The SqlDataSourceItem is configured to do this:

loParam.Value = "%" & CType(loWhere.Values(0), String) & "%"

when you use Contains... something else is amiss...

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Are you using the SqlDataSourceItem?
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search