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 576217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:01:26+00:00 2026-05-13T14:01:26+00:00

Now this is tricky… I hope i can explain it well.. I have a

  • 0

Now this is tricky… I hope i can explain it well..

I have a a table which names in it and i need to compare it with the word i provide and get the exact match out..

Now i say it is tricky because i tried this query and it gave me a set of names. It contained the word which was an exact match and also words which were similar…

this is what i did:

DataTable dt = new DataTable();
        SqlConnection connection = new SqlConnection();
        connection.ConnectionString = ConfigurationManager.ConnectionStrings["xyz "].ConnectionString;
        connection.Open();
        SqlCommand sqlCmd = new SqlCommand("SELECT Names FROM Machines WHERE Name  Like '%' + @userName + '%'", connection);
        SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);

        sqlCmd.Parameters.AddWithValue("@userName", userName);

        sqlDa.Fill(dt);
        connection.Close();

Now what i want is… for example.

if the database has three words

abc123

xyz123

pqc1238

Now if the word is 123 it should
return abc123 and xyz123
if c123 then return abc123 and NOT pqc1238 and xyz123

if 238 then just return pqc1238….

I hope i was clear enough… trust me i did not get it the first time either

any suggestions are better to fingd the exact matches between words.. coz LIKE is not sufficient..

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. Editorial Team
    Editorial Team
    2026-05-13T14:01:26+00:00Added an answer on May 13, 2026 at 2:01 pm

    To me, it looks like you are search for string ending with @userName.

    SqlCommand sqlCmd = new SqlCommand("SELECT Names FROM Machines WHERE Name  Like '%' + @userName", connection);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hope you guys can give me a hand now! this is tricky to me
Now this must be easy, but how can sum two NSNumber ? Is like:
The best I can come up with for now is this monstrosity: >>> datetime.utcnow()
Now I have seen this question in another forum but it didn't had an
Now this is tricky. I am trying to do WAP testing using firefox and
I need to solve the following question which i can't get to work by
This one is a little tricky to explain. I would like to create a
Now this is .NET but I am sure the principal should apply to all
Does your work environment use Harvest SCM? I've used this now at two different
I am getting this error now that I hit version number 1.256.0: Error 4

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.