views:

23

answers:

1

Is there a better way to use LINQ to act as a counter each time a button is pressed?

Seems like there should be a better way then having a LINQ statement run and get the current value and then an addition statement to insert the old value + 1.

+3  A: 

It strikes me that this is the kind of thing that LINQ isn't really suitable for... a stored procedure or something similar would make more sense: do it all in one call to the database.

Note that LINQ to SQL can still access stored procedures, so you don't need to step into a completely different model - you just don't need a LINQ query either.

Jon Skeet
Oh is it that early? I suppose so. I cant believe in all of my LINQ hype and fun I forgot about stored procedures!
Landmine