المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Stuck trying to learn to do SubmitChanges



C# Programming
01-23-2010, 04:40 AM
The table (Password) has only 1 column (Password1) and only 1 row. It is also the PrimaryKey.
I can retrieve the password:
thePassword =
from tt in MainMenu.db.Password
select tt;
try
{
password = thePassword.ElementAt(0).Password1;
...

I am trying to change the value.
if ((from tt in MainMenu.db.Password
select tt).Count() > 0)
{
Password zz = MainMenu.db.Password.Single(); // or ElementAt(0) or ??
zz.Password1 = newPassword;
try
{
MainMenu.db.SubmitChanges();
}
...

I get the runtime error "A member defining the identity of the object cannot be changed ..."