Monday, July 08, 2013

Inserting Entities

In the YELLOW is KEY

'Insert Entity and Database
            Using Context As New qmEntities()
                Dim myServiceDefinition = New tbl_service_definitions()
                myServiceDefinition.srvc_def_desc = txtSrvDefDesc.Text.Trim()
                myServiceDefinition.eff_dt = txtsrvEffDt.SelectedDate
                myServiceDefinition.end_dt = txtsrvEndDt.SelectedDate
                myServiceDefinition.update_dt = DateTime.Now
                myServiceDefinition.update_by_id = SecurityMethods.GetLoginUserId(Session("AuthUser"))
                myServiceDefinition.create_dt = DateTime.Now
                myServiceDefinition.created_by_id = SecurityMethods.GetLoginUserId(Session("AuthUser"))
                myServiceDefinition.active = True
                Context.tbl_service_definitions.Add(myServiceDefinition)
                Context.SaveChanges()
            End Using
Post a Comment