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

  • Home
  • SEARCH
  • 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 63k
  • Answers 64k
  • 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
  • added an answer http://www.connectionstrings.com/ Standard Security Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;Use serverName\instanceName as Data… May 11, 2026 at 10:39 am
  • added an answer It depends on what you're trying to accomplish. I lean… May 11, 2026 at 10:39 am
  • added an answer From the PHP manual: String conversion to numbers When a… May 11, 2026 at 10:39 am

Related Questions

So, I have a method that performs a parametrised LIKE query. The method takes
Suppose that I have a Java class with a static method, like so: class
Ok so I have a number of methods that look like this:- which sorts
I have a simple extension method on the int type so I can do
So I basically want to have a static method in my AR class to
So, I have a few extension methods, for commonly used stuff, and in documenting
I have a class like so: public class ClassA { public bool MethodA() {
So, I have a nice domain model built. Repositories handle the data access and
So, I have a WindowsFormsHost control in my WPF app (hosting a Dundas Chart)
So, I have a DataGridView using as datasource a BindingList DataGridView.DataSource = new BindingList<Car>{...}

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.