devxlogo

July 5, 2016

Outside Groups Work on a New Version of Java EE

Frustrated with Oracle’s slow pace of work on Java EE, two outside groups?Java EE Guardians and MicroProfile.io?say they are working on enhancements for the open source platform on their own.

Using LINQ for Queries

LINQ?is?very?good?and?efficient?when?it?comes?to?handling?data?coming?from?a?datasource.?This?little?example?creates?a?Table?object.?Then?creates?a?DataContext?to?interpret?the?Table?data,?and?finally?does?a?query?to?extract?the?wanted?data. ????????[Table(Name?=?”Courses”)] ????????public?class?Courses?//Create?Courses?Table ????????{ ????????????[Column(IsPrimaryKey?=?true,?DbType?=?”BIGINT?NOT?NULL?IDENTITY”,?IsDbGenerated?=?true)] ????????????public?Int32?CourseID;?//Field ????????????[Column] ????????????public?string?CourseDesc;?//Field ????????} ????????????????using?(DataContext?dcCourses?=?new?DataContext(“CONNECTION_STRING))?//Connect?to?DB ????????????????{ ????????????????????var?data?=?(from?c?in?_Courses ????????????????????????????????where?c.CourseID?==?ComboBox1.SelectedIndex ????????????????????????????????select?new?{?c.CourseDesc?} ????????????????????).FirstOrDefault();?//Select?CourseID?That?Corresponds?to?ComboBox?Selection ????????????????????TextBox1.Text?=?data.Name;?//Display ?????????????????}