If Not Exists(Select * From <tablename> where <filter expression>) Insert Into <tablename>(<coulmns>) Values(<values>) Else Update <tablename> Set value=<value> where userid=2
var db = new DataContext(); var user = db.User.Where(x => x.UserId == 2) if(user != null) { //Your code here... }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)