473,320 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Linq: no update in row

Hi,

Here is my code:

MyDataContext db = new MyDataContext();
Profile profile = db.Profiles.Single(u =u.UserId == userId);

// Edit
profile.Surname = surname;
profile.DateOfBirth = dateOfBirth;
profile.LastUpdate = DateTime.Now;

// Update
db.SubmitChanges();

Here is my situation:
- The data connection works (the user profile gets selected with database
values)
- All input values are new (surname, dateOfBirth, and DateTime.Now)
- I receive no errors, but the row gets not updated for some reasons.

Any ideas why not?

Thanks!

Jul 5 '08 #1
1 1286

"Arjen" <bo*****@hotmail.comschreef in bericht
news:0F**********************************@microsof t.com...
Hi,

Here is my code:

MyDataContext db = new MyDataContext();
Profile profile = db.Profiles.Single(u =u.UserId == userId);

// Edit
profile.Surname = surname;
profile.DateOfBirth = dateOfBirth;
profile.LastUpdate = DateTime.Now;

// Update
db.SubmitChanges();

Here is my situation:
- The data connection works (the user profile gets selected with database
values)
- All input values are new (surname, dateOfBirth, and DateTime.Now)
- I receive no errors, but the row gets not updated for some reasons.

Any ideas why not?

Thanks!

Aha, I forgot to set the primary key. Stupid!

Jul 5 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: martin | last post by:
I'm just wondering... Will it be possible to use C# 3.0 and Linq to objects without having our users download the .NET Framework 2.0 client? I really would like to use the C# 3.0 features, but I...
7
by: Ronald S. Cook | last post by:
I've always been taught that stored procedures are better than writing SQL in client code for a number of reasons: - runs faster as is compiled and lives on the database server - is the more...
4
by: =?Utf-8?B?V2lsc29uIEMuSy4gTmc=?= | last post by:
Hi Experts, I am doing a prototype of providing data access (read, write & search) through Web Service. We observed that the data storing in SQL Server 2005, the memory size is always within...
1
by: john | last post by:
LINQ works a lot like an Access DB Recordset in the way it functions, one of the things I could do in Access is refer to the Fields thru a Variable as below allowing me to Iterate over the...
0
by: shapper | last post by:
Hello, I have 3 tables: Files FileID, Url, ... Tags TagID, Name, ... FilesTags FileID, TagID, ... FilesTags is used to associate tags to each file.
2
by: stephen | last post by:
Hi, I apologize for posting Linq questions here. I wanted to try to work with Linq and found a Linq (May 2006) CTP that can be used with .NET 2005. when I run the msi, i get this message: "A...
4
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post by:
We’re storing our main entity in an insert only table which stores the history of past revisions, but we’re facing problems with storing this history as LINQ will only update the entity, and...
14
by: thj | last post by:
Hi, I was wondering what you guys are using and why? LINQ to SQL or NHibernate? Thanks in advance, Tommy
0
by: mesut | last post by:
Hi, I'm using LINQ.. and I would like to understand if it's a bug or not in LINQ... I've a situation like: I'm reading all records via "Select" Statement and a specific select statment #1...
1
by: Sergey Topychkanov | last post by:
I have SQL SERVER 2008 Express and C# Express 2008 - both sp1. I can remove and update data in my database only thru direct SQL query thru database explorer, but quite unable to do it through...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.