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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:06:59+00:00 2026-06-10T06:06:59+00:00

So lets say I’m retrieving some data with a linq query as so: DataContext

  • 0

So lets say I’m retrieving some data with a linq query as so:

DataContext db = new DataContext    

using(db)
{
    var test = from t in db.table1
               where t.col1 == Convert.ToInt32(HiddenField1.Value)
               select new
               {
                  t.col2,
                  t.col3
               };
}

I then want to check if a condition is not true like:

if (col3 != something){ }

How can I achieve this?

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-06-10T06:07:01+00:00Added an answer on June 10, 2026 at 6:07 am

    If your check is supposed to be done in sql, then the answer by Dave Markle must suit you.
    If you want to apply this check on some of the returned entities, it should look somewhat like this:

    1. get your objects through foreach:

      foreach(var o in test)
      {
      if(o.col3!= something)
      {
      ...
      }
      }

    2. or use linq to objects:

      test.ToList().Where(o=>o.col3!=something);

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

Sidebar

Related Questions

Lets say I have a div like this: <div id=test class=sourcecode> Some String </div>
Lets say I allocate an array of ints int test[] = new int[100]; I
Lets say that I purchased a new domain (somedomain.com) from a domain registar and
Lets say when I run the following query, SELECT NAME FROM EMP; It return
Lets say we have a table here, populated with the following data: acc_id1 acc_id2
Lets say I have five tables named table1, table2 ... table5. I have already
lets say i created a virtualenv called venv (virtualenv venv) From reading tutorials, i
Lets say I have multiple commands like 5000 which updates some column and row
Lets say I have a .c file with some methods, and I create a
Lets say in a file I have some code in two files part of

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.