Example #1
0
        public void DeleteKarla()
        {
            Student karla = dataContext.Students.FirstOrDefault(s => s.Name.Equals("Karla"));

            dataContext.Students.DeleteOnSubmit(karla);

            dataContext.SubmitChanges();

            //in case of error:
            string connectionString            = ConfigurationManager.ConnectionStrings["WpfApp_LinqToSQL.Properties.Settings.ExampleDB1ConnectionString"].ConnectionString;
            LonqToSqlDataClassesDataContext db = new LonqToSqlDataClassesDataContext(connectionString);


            MainDataGrid.ItemsSource = dataContext.Students;
        }
Example #2
0
        public MainWindow()
        {
            InitializeComponent();
            //ExampleDB1ConnectionString
            // - is going to be _
            string connectionString = ConfigurationManager.ConnectionStrings["WpfApp_LinqToSQL.Properties.Settings.ExampleDB1ConnectionString"].ConnectionString;

            dataContext = new LonqToSqlDataClassesDataContext(connectionString);

            //InsertUniversities();
            //InsertStudents();
            //InsertLectures();
            //InsertStudentLectureAssociations();
            //GetUniversityOfMark();
            //GetLecturesOfMark();
            //GetAllStudentsFromYale();
            //GetAllUniversitiesWithFeMales();
            //UpdateMark();
            DeleteKarla();
        }