private void ESC_Click(object sender, RoutedEventArgs e)
        {
            Window_Project window_Start1 = new Window_Project();
            window_Start1.Show();
            this.Close();//关闭当前窗口

        }
        private void ENT_Click()
        {
            if (tbItemName.Text.Trim() != "")
            {
                OleDbConnection conn = new OleDbConnection(odbcConnStr);
                conn.Open();


                string sql = "select * from ItemInfor where ItemName='" + tbItemName.Text.Trim() + "'";
                OleDbCommand cmd = new OleDbCommand(sql, conn);
                if (cmd.ExecuteScalar() != null)
                {
                    MessageBox.Show("已经存在的项目名称!", "提示");
                }
                else
                {
                    sql = "insert into ItemInfor (ItemName,ItemAuthor,ItemAnnotation,ItemDate) values ('"
                        + tbItemName.Text.Trim() + "','" + tbItemAuthor.Text.Trim() + "','" + tbItmeAnnotation.Text.Trim() + "','" + DateTime.Now.ToString() + "')";
                    cmd.CommandText = sql;
                    cmd.ExecuteNonQuery();
                    GlobalVariables.OpenItem = tbItemName.Text.Trim();
                    // lb_default.Content = tbItemName.Text.Trim();
                    MessageBox.Show("项目添加成功!");
                    Window_Project Window_Project1 = new Window_Project();
                    Window_Project1.Show();
                    this.Close();

                }
                conn.Close();
            }
            else
            {
                MessageBox.Show("项目名称不能为空!", "提示");
            }

        }
コード例 #3
0
 private void OpenProject(object sender, RoutedEventArgs e)
 {
     Window_Project window_Project = new Window_Project();
     window_Project.Show();
     this.Close();//关闭当前窗口
 }
 private void ESC_Click()
 {
     Window_Project window_project = new Window_Project();
     window_project.Show();
     this.Close();//关闭当前窗口
 }
        private void ENT_Click(object sender, RoutedEventArgs e)
        {
   
            DataRowView dav = (DataRowView)ListView1.SelectedItem;
            GlobalVariables.OpenItem = dav["ItemName"].ToString();
            BT_default.Content = GlobalVariables.OpenItem;
            Window_Project window_Start1 = new Window_Project();
            window_Start1.Show();
            this.Close();//关闭当前窗口
           // MessageBox.Show(dav["ItemName"].ToString());

            //存储当前项目ID号
          /*  OleDbConnection conn = new OleDbConnection(odbcConnStr);
            conn.Open();
            string sql = "select ItemID,ItemName from ItemInfor where ItemName='" + itemlist.SelectedItem.ToString().Substring(0, 15).Trim() + "'";
            MessageBox.Show(sql);
            OleDbDataAdapter adp = new OleDbDataAdapter(sql, conn);
            DataSet ds = new DataSet();
            adp.Fill(ds);
            MessageBox.Show(ds.Tables[0].Rows[0]["ItemID"].ToString().Trim());
            Window_Project11.CurrentItemID = int.Parse(ds.Tables[0].Rows[0]["ItemID"].ToString().Trim());*/
        }