Database and Entity Classes C# Help

The sample database CourseManagement that is used with the transactions in this chapter is defined by the-structure from Figure 22-2. The table Courses contains information about courses: course numbers and titles; for example, the course number 2124with the title Programming Ct. The table CourseDa tes contains ‘the date of specific courses and is linked to the Courses table. The table Students contains information about persons attending a course. The table CourseAttendees is the link between Students and CourseDates. It defines which student is attending what course.

can download the diltabase along with the source code for this chapter from the WrOx web site.

Figure 22·2

Figure 22·2

The sample applications in this chapter use a library with entity and data access classes. The class Student contains properties to define a student; for example, FirstName, LastName, and Company: using System;

Adding studen£information to the database is done in the method AddStudent () of the class StudentData. Here, an ADO.NET connection is created to connect to the SQLServer database, the Sql(:ommand object defines the SQLstatement, and the command is executed by invoking ExecuteNonQue’ry ()

using System

using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System…Transactions;

 

Posted on October 31, 2015 in Transactions

Share the Story

Back to Top