Пример #1
0
 /**
  * @brief   DelData
  * @param[in]    string  nameString  登録名
  * @return     void
  * @note       Table から 引数で受けた名前のデータ削除
  */
 void DelData(string nameStr)
 {
     var db = new DataClasses1DataContext(ConnectionString);
     var que = from tb in db.Table1
               where tb.Name.Contains(nameStr)
               select tb;
     foreach (var slct in que)
     {
         db.Table1.DeleteOnSubmit(slct);
     }
     db.SubmitChanges();
 }
Пример #2
0
 /**
 * @brief   AddOneData
 * @param[in]    string  nameString  登録名
 * @return     void
 * @note       Table に 引数で受けた名前のデータ登録
 */
 void AddOneData(string nameStr)
 {
     var db = new DataClasses1DataContext(ConnectionString);
     Table1 tb = new Table1();
     tb.Name = nameStr;                    // 作者
     db.Table1.InsertOnSubmit(tb);
     db.SubmitChanges();
 }
Пример #3
0
        /**
           * @brief   button3_Click
           * @param[in]  object     e
           * @param[in]  EventArgs  e
           * @return     void
           * @note       "Asan"/"Bsan" textBox1 に表示
           */
        private void button3_Click(object sender, EventArgs e)
        {
            var db = new DataClasses1DataContext(ConnectionString);

            var q =
              from s in db.Table1
              where s.Name.Contains("Asan") || s.Name.Contains("Bsan")
              select new { Title = s.Name };

            textBox1.Clear();
            foreach (var s in q)
            {
                Console.Write("{0}\n", s.Title);
                textBox1.AppendText(s.Title + "\n");
            }
        }