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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:37:06+00:00 2026-05-25T20:37:06+00:00

When I execute the following code I don’t get any error, but it doesn’t

  • 0

When I execute the following code I don’t get any error, but it doesn’t update the changes on the database either. I have 5 entries in the table user, and after executing the following code there is no user with “Active” state in the database.

Am I supposed to write the update statement myself or does it do it for me? What can be the problem here?

var dbContext = new DataClasses1DataContext();

List<user> users = (from u in dbContext.users
                          where u.age < 30
                          select u).ToList();

users[0].state = "Active";
dbContext.SubmitChanges();

EDIT:

So I know what the problem is.
I change the State on my object, and the update statement contains the state as a where clause.
So when executing the query it can’t find an item that matches – it fails on [state] = @p4.

Why is it using all parameters in my update statement when I have a primary key?

UPDATE [dbo].[user]
SET [state] = @p5
WHERE ([id] = @p0) AND ([firstName] = @p1) AND ([lastName] = @p2) 
    AND ([age] = @p3) AND ([state] = @p4)
-- @p0: Input Int (Size = -1; Prec = 0; Scale = 0) [1]
-- @p1: Input NChar (Size = 10; Prec = 0; Scale = 0) [firstName     ]
-- @p2: Input NChar (Size = 10; Prec = 0; Scale = 0) [lastName  ]
-- @p3: Input Int (Size = -1; Prec = 0; Scale = 0) [25]
-- @p4: Input NChar (Size = 10; Prec = 0; Scale = 0) [Active    ]
-- @p5: Input NChar (Size = 10; Prec = 0; Scale = 0) [Active]
  • 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-25T20:37:07+00:00Added an answer on May 25, 2026 at 8:37 pm

    You need to change the concurrency pattern on your DBML. This website about Updating LINQ-to-SQL entities explains a bit about it.

    Anything you don’t want to include in the WHERE clause should have their Update Check set to Never on the DBML.

    • Open DBML
    • Select the state property on your user object
    • Press F4 (to see properties)
    • Change Update Check (the last setting in the properties) to Never
    • Save and try again

    Normally I’d turn off Update Check for all columns but you should do more reading to understand exactly how it works in case you need concurrency.

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

Sidebar

Related Questions

I get the following error when I try and execute the code down below.
To test if i can connect to my database, I execute the following code
I got error Access Violation when the following code is execute : void NoAction()
Say that I have the following code: ExecutorService executor = Executors.newSingleThreadExecutor(); executor.execute(myRunnable); Now, if
I have the following code: $bind = new COM(LDAP://CN=GroupName,OU=Groups,OU=Division,DC=company,DC=local); When I execute it from
I have the following Python code: cursor.execute("INSERT INTO table VALUES var1, var2, var3,") where
I have the following code which lets me execute a workflow. This could be
I want to execute following code on button click but the follwing code executes
When I execute the following code, I get ConcurrentModificationException Collection<String> myCollection = Collections.synchronizedList(new ArrayList<String>(10));
I have the following code on an ASP page: <% QueryToJSON(conn, execute WebGetEmployeesPlanned' +Request.QueryString(customercode)+',

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.