Wednesday, May 23, 2018

Generate New Identity Value if table has only 1 column

//Using SqlServer
Create table tbl_UniqueIds
(
ID int identity(4000,1)
)

insert into tbl_UniqueIds DEFAULT VALUES 


=======================================
//Using Linq c#
 public static int CreateSysUniqueId(short tableId)
        {
  using (var entity = new EmployeeDataEntities())
            {
                var res = new tbl_UniqueIds
                {                    
                };
                entity.tbl_UniqueIds.Add(res);                

                entity.SaveChanges();
                return res.ID;
        }
}

No comments:

Post a Comment

javascript Filter/index off

 var family = [{"name":"Jack",  "age": 26},               {"name":"Jill",  "age"...