コード例 #1
0
        private void SubmitAdd_Click(object sender, RoutedEventArgs e)
        {
            if (Convert.ToInt32(InCount.Text) < 0)
            {
                MessageBox.Show("错误:归档数量不能为负数!");
                return;
            }
            else if (Detail.Text.Length > 100)
            {
                MessageBox.Show("错误:说明不能超过一百字!");
                return;
            }
            string InDate = DateTime.Now.ToString("yyyy-MM-dd") + " " + DateTime.Now.ToLongTimeString().ToString();; //获取当前时间
            string SQL1   = "insert into DataIn values ('" + InDate + "','" + DataNo.Text + "','" + InCount.Text + "','" + Usersname.Text + "','"
                            + Ryname.Text + "','" + Detail.Text + "','" + Flag.Text + "')";

            try
            {
                SqlCommand CMD_1 = new SqlCommand(SQL1, Temp.GetConn());
                CMD_1.ExecuteNonQuery();
            }
            catch
            {
                MessageBox.Show("错误:类型编号重复,或不可重复添加!");
                return;
            }
            TableToDataFile.DataTableSelect(SQLStr, "更新");
            dt = TableToDataFile.Getdt();
        }
コード例 #2
0
        int IdCount       = 0;              //已删除的归档号数量
        public ConfidentialMembers_NewEquipmentInformationAdded()
        {
            InitializeComponent();

            InitTable();
            Initttalbm();
            TableToDataFile.DataTableSelect(SQLStr, "更新");
            TableToDataFile.dataGrid.SelectionChanged += TableToDataFile_SelectionChanged;
            dt = TableToDataFile.Getdt();
            ArchiveTotal.Content = dt.Rows.Count;//获取总行数
        }