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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:34:45+00:00 2026-06-13T18:34:45+00:00

I am making a search index. I got it working pretty good but I

  • 0

I am making a search index. I got it working pretty good but I cannot incorporate ItemID (item numbers) in my search because i am having trouble converting the String in the TextBox.Text to a int in order for it to be a comparable type.

var q = (from t0 in db.Item
         join t1 in db.Categories on t0.CategoryID equals t1.CategoryID
         join t2 in db.Divisions on t0.DivisionID equals t2.DivisionID
         where t0.DivisionID == DDLInt &&
         //Contains
         (t0.ItemName.Contains(txtSearch.Text.Trim()) ||
         t0.Email.Contains(txtSearch.Text.Trim()) ||
         t0.Description.Contains(txtSearch.Text.Trim()) ||
         t0.Phone.Contains(txtSearch.Text.Trim()) ||
         t0.ItemID.Equals(txtSearch.Text.Trim())) 
               // ^ This is the line where  
               //   it breaks because it is not a comparable type
         group t0 by new
         {

I am not sure how to convert or parse it and still have the search work properly.

  • 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-13T18:34:46+00:00Added an answer on June 13, 2026 at 6:34 pm

    Either parse the string to an int:

    t0.ItemID.Equals(Convert.ToInt32(txtSearch.Text.Trim()))) 
    

    or convert the int to a string:

    t0.ItemID.ToString().Equals(txtSearch.Text.Trim())) 
    

    or take the conversion out of the query:

    int searchID;
    if !int.TryParse(txtSearch.Text.Trim(),out searchID)
        searchID = -1;  // set to an invalid ID
    
    var q = (from t0 in db.Item
         <snip>
         t0.ItemID.Equals(searchID)) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a trouble, making Ninject and WebAPI.All working together. I'll be more specific:
I am making a search query on local Apache Solr Server by browser and
I am using SQL Server 2000 and ASP.Net with c# for making a search
I'm making a simple search form in rails. In my search view I have
Ok, I attempted at making my own search function which doesnt work very well.
I am making a form to search for colleges based on athletic programs offered
I have been reading about making ajax heavy applications more search engine friendly: https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
I'm writing a Seam-based application, making use of JPA/Hibernate and Hibernate Search (Lucene). I
Making a new site but something is happening to it in IE8. The social
Good afternoon all, I've got a controller running a before filter with an except

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.