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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:04:07+00:00 2026-06-04T18:04:07+00:00

I have the following SQL fragment that I cannot figure out how to translate

  • 0

I have the following SQL fragment that I cannot figure out how to translate into LINQ

(p.prioid LIKE '1%' OR p.prioid LIKE '2%' OR p.prioid LIKE '3%')

I attempted this:

(p.prioid.Contains(1) || p.prioid.Contains(2) || p.prioid.Contains(3))

but receive the following error message: “cannot convert from int to string”

I checked the table and the 1, 2, and 3 are int data types so I don’t think it would work properly if I converted the ints to strings by placing quotation marks.

  • 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-06-04T18:04:08+00:00Added an answer on June 4, 2026 at 6:04 pm

    LIKE will only work using string data provided, even if you are searching in other datatypes.

    if you notice, even in SQL, you are submitting them as strings.

    p.prioid LIKE '1%' OR p.prioid LIKE '2%' OR p.prioid LIKE '3%'
    

    a quick fix will be using .ToString() and submit your query.

    (p.prioid.Contains(1.ToString()) || p.prioid.Contains(2.ToString()) || p.prioid.Contains(3.ToString()))
    

    I guess this will be using some sort of variables rather than fixed values like the example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following SQL, which I am trying to translate to LINQ: SELECT
I have the following SQL that works directly in MySQL INSERT INTO `my_tabel` (`data`)
Hi I have following sql statement that gives me the the first_name and total
I have the following SQL snippet within a select statement: CASE WHEN wot.id LIKE
I have the following SQL statement: SELECT ID, NAME FROM myTable WHERE ID LIKE
I have following sql syntax. This works fine but I was wondering if there
I have the following SQL statement: USE ws_results_db_2011_09_11_09_06_24;SELECT table_name FROM INFORMATION_SCHEMA.Tables WHERE table_name like
I have following SQL query that selects some results from my table: select avg(c3),
I have the following SQL (SQL Server 2005) that I use to calculate the
I have the following simple XML fragment shown below. What would the T-SQL look

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.