EDIT: Issue was fixed by switching to VARCHAR instead of using CHAR for the database.
Hello all,
I'm just starting out with VB and C# to create a small database application (using the sql compatible internal database provided in the suite). I'm having an issue with the search function I'm trying to implement in my form. It seems that no matter what I try, I'm not able to make the wildcard character (%) work.
Right now the query looks something like:
LIKE '%' @searchvar '%'
However, if I try to search for "Test", the query will only return columns with an exact match, and not with columns containing Test1, etc.
Also, if I try to input the % character when submitting the form, say with "Test%", it will return "Test1" and "Test2" but not "Test12345"
Any idea what could be causing these issues? I tried different variation of the queries such as LIKE @searchvar or LIKE @searchvar '%' but they both seem to return exact matches.
Maybe I'm missing something really obvious?Any tutorial I see seems to mention this exact syntax for the query, but it doesn't work for me :(
Post Details
- Posted
- 10 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/dotnet/comm...