Example #1
0
        private void btnDel_Click_1(object sender, RoutedEventArgs e)
        {
            CardListBox.ItemsSource = null;
            SourceData sd      = new SourceData(dbPath);
            var        results = from item in sd.Cards select item;

            foreach (var i in results)
            {
                sd.Cards.DeleteOnSubmit(i);
            }
            sd.SubmitChanges();
        }
Example #2
0
 private void btnAdd_Click_1(object sender, RoutedEventArgs e)
 {
     SourceData sd = new SourceData(dbPath);
     try
     {
         Card card = new Card() { ID = 1, Name = "kai1", Email = "*****@*****.**", Address = "地球", Phone="123" };
         Card card2 = new Card() { ID = 2, Name = "测试中文", Email = "*****@*****.**", Address = "月亮", Phone="234" };
         sd.Cards.InsertOnSubmit(card);
         sd.Cards.InsertOnSubmit(card2);
         sd.SubmitChanges();
     }
     catch
     {
         MessageBox.Show("Data already exists");
     }
 }
Example #3
0
        private void btnAdd_Click_1(object sender, RoutedEventArgs e)
        {
            SourceData sd = new SourceData(dbPath);

            try
            {
                Card card = new Card()
                {
                    ID = 1, Name = "kai1", Email = "*****@*****.**", Address = "地球", Phone = "123"
                };
                Card card2 = new Card()
                {
                    ID = 2, Name = "测试中文", Email = "*****@*****.**", Address = "月亮", Phone = "234"
                };
                sd.Cards.InsertOnSubmit(card);
                sd.Cards.InsertOnSubmit(card2);
                sd.SubmitChanges();
            }
            catch
            {
                MessageBox.Show("Data already exists");
            }
        }
Example #4
0
 private void btnDel_Click_1(object sender, RoutedEventArgs e)
 {
     CardListBox.ItemsSource = null;
     SourceData sd = new SourceData(dbPath);
     var results = from item in sd.Cards select item;
     foreach (var i in results)
     {
         sd.Cards.DeleteOnSubmit(i);
     }
     sd.SubmitChanges();
 }