Coming soon - Get a detailed view of why an account is flagged as spam!
view details
6
Visual Studio 2013 - Database search issue
Post Body

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

Author
Account Strength
100%
Account Age
15 years
Verified Email
Yes
Verified Flair
No
Total Karma
33,400
Link Karma
27,158
Comment Karma
6,043
Profile updated: 1 week ago
Posts updated: 10 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
10 years ago