Search found 3 matches

by nlundberg
Mon 02 Nov 2009 15:38
Forum: LinqConnect (LINQ to SQL support)
Topic: System.InvalidOperationException: Handle is not initialized
Replies: 7
Views: 6888

System.InvalidOperationException: Handle is not initialized

This exception occured when I ran an ASP.NET Application with WebDev.WebServer.exe. It was performing multiple insert statements.

An unhandled exception occurred and the process was terminated.
Application ID: c0fb25be
Process ID: 952
Exception: System.InvalidOperationException
Message: Handle is not initialized.

StackTrace: at System.Runtime.InteropServices.GCHandle.get_Target()
at Devart.Data.Linq.o.i()
at Devart.Data.Linq.d.a(Int32 A_0)
at Devart.Data.Linq.y.a(a A_0)
at Devart.Data.Linq.y.a.b()
by nlundberg
Thu 15 Oct 2009 06:37
Forum: LinqConnect (LINQ to SQL support)
Topic: Update uses every 'not changed property' as a key
Replies: 2
Views: 2000

Sorry I missed that. It solved my problem. Thanks!
by nlundberg
Wed 07 Oct 2009 21:37
Forum: LinqConnect (LINQ to SQL support)
Topic: Update uses every 'not changed property' as a key
Replies: 2
Views: 2000

Update uses every 'not changed property' as a key

Hi,

When performing an update of an item and only few of the item's properties have changed then all not changed properties are used as keys in the update statement generated by Linq To Sql.

I'm using the latest version released (2009-10-07) of dotConnect for MySQL.

Here is an pseudo code example. Only relevant code is presented.


//old password == "myoldPw"
_password = "myNewPassword;


var data = (from user in dataContext.Users where user.UserId == id select item).Single();

data.UserId = _userId
data.Username = _username;
data.Email = _email;
data.IsUnlocked = _isUnlocked;
data.Created =_created;
data.Password = _password

dataContext.SubmitChanges();

The sql statement generated is:

UPDATE user SET Password = :p1 WHERE UserId = :key1 AND Username = :key2 AND Email = :key3 AND IsUnlocked...


Thanks
Niklas