Sunday, September 18, 2016

To insert the current table id into the next table in linq c#

     userdetail ud = new userdetail();

            ud.username = "a";

            ud.password = "a";

            ud.createddate = DateTime.Now;

            ud.createdtime = DateTime.Now;

            dbcontext.userdetails.Add(ud);

            dbcontext.SaveChanges();


            record rd = new record();

            rd.createddt = DateTime.Now;

            rd.uid = ud.uid;


            dbcontext.records.Add(rd);

            dbcontext.SaveChanges();


No comments:

Post a Comment

Git Commands

Git Version   To check the git version Git -v       Git Clone To clone the repository, use the following command: Git clone [u...