Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 110349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:12:47+00:00 2026-05-11T02:12:47+00:00

So, I have a method that performs a parametrised LIKE query. The method takes

  • 0

So, I have a method that performs a parametrised LIKE query. The method takes in the search parameter/value in and then it is added to the command ready for the query.

It is not working. It should work, and when I code the value to search for directly into the SQL string, sans parametrisation, it does work! When I have it as a parameter is does not! Any ideas.

Here is some (fake, I have changed the names) example code.

myDataReader = SQLExecute('SELECT * FROM TableOfAwesomeness WHERE BestTVShow LIKE 'Arrested Development%'') 

Would work. However

Function MethodOfReturningHorror(ByVal TVShow as String) as SqlDataReader { dim command as new SQLCommand command.connection = sqlconnection command.CommandText = 'SELECT * FROM TableOfAwesomeness WHERE BestTVShow LIKE '@tvShow%'' command.Parameters.Add('tvShow',TVShow)  return command.ExecuteReader() } 

I have missed out code unrelated to the question for the sake of laziness/conciseness. So ignore the return bit and and stuff, all that is important is that the data reader contains nothing, while It does in the first example. I am sure it’s to do with the parametrisation of the LIKE clause .

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:12:47+00:00Added an answer on May 11, 2026 at 2:12 am

    Try this:

    command.CommandText = 'SELECT * FROM TableOfAwesomeness WHERE BestTVShow LIKE @tvShow + '%'' 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There are (at least) two ways to handle this. 1>… May 11, 2026 at 11:39 pm
  • Editorial Team
    Editorial Team added an answer How do you determine what PostgreSQL is storing? How do… May 11, 2026 at 11:39 pm
  • Editorial Team
    Editorial Team added an answer In 3.0, this is quite hard; but was improved in… May 11, 2026 at 11:39 pm

Related Questions

Greetings, I have two questions regarding a DataTable.Select(): 1) How to escape potential apostrophes
I have a .NET class library containing a class with a method that performs
Example: I have a selector like this, which I give to another method as
I have a problem. I've been trying to tackle it for a while now

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.