private void button4_Click(object sender, EventArgs e) { var CoursesTableAdapter = new Learning_databasesDataSetTableAdapters.CoursesTableAdapter(); var courseId = (int)CoursesTableAdapter.InsertCourse(CourseName.Text, int.Parse(CourseLength.Text), int.Parse(RoomName.Text)); MessageBox.Show(courseId.ToString()); }
private void btnCourses_Click(object sender, EventArgs e) { var courseAdapter = new Learning_databasesDataSetTableAdapters.CoursesTableAdapter(); var courseTable = courseAdapter.GetData(); StringBuilder allClasses = new StringBuilder(); // Loop through each returned student row and add name/second name to string foreach (var coursesRow in courseTable.Rows.Cast <Learning_databasesDataSet.CoursesRow>()) { allClasses.AppendLine(coursesRow.Description); } MessageBox.Show(allClasses.ToString()); }