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


Author
Message
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
I have a table with a varchar(2) field in it.  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'.  I figured this was due to the varchar(2) field.

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 ?

Thanks,

Robin Giltner

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

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