コード例 #1
0
ファイル: UpFile.cs プロジェクト: billion212/repo1
        public bool UpfdateUpFile(UpFile objUpFile)
        {
            Boolean tf = false;

            DBConnect dbconn = new DBConnect();

            dbconn.ConnectDB();

            try
            {
                // 注意 :  字串要用單引號  ' ',  數字欄位不需要單引號
                dbconn.getCmd().CommandText = "Update FileData SET  FixContent='" + objUpFile.GetFFixContent() + "',Status='" + objUpFile.GetFileStatus() + "'  WHERE FileNumber= '" + objUpFile.GetFileNumber() + "'";
                dbconn.getCmd().CommandType = System.Data.CommandType.Text;
                dbconn.getConn().Open();
                dbconn.getCmd().ExecuteNonQuery();
                tf = true;
            }
            catch (Exception e)
            {
                System.Console.WriteLine("Error message :" + e.ToString());
            }
            finally
            {
                if (dbconn.getConn() != null)
                {
                    dbconn.getConn().Close();
                }
            };

            return(tf);
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                UpFile u = new UpFile();
                u.SetFileNumber(comboBox2.Text);
                u.SetFileTitle(textBox3.Text);
                u.SetFileContent(textBox2.Text);
                u.SetFileStatus("0");

                if (u.UpfdateFileInfo(u))
                {
                    MessageBox.Show("更新公文編號:" + comboBox2.Text + "成功");
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox3.Text = "";
                }
                else
                {
                    MessageBox.Show("更新公文編號:" + comboBox2.Text + " 失敗");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            UpFile u2 = new UpFile();

            u2             = u2.Retrieveq(comboBox2.Text);
            textBox1.Text  = u2.GetFileContent();
            label1.Text    = "公文標題:" + u2.GetFileTitle();
            label6.Text    = "需修改內容:" + u2.GetFFixContent();
            comboBox1.Text = "";
            comboBox2.Text = "";
        }
コード例 #3
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            UpFile u = new UpFile();

            u             = u.Retrieveq(comboBox2.Text);
            textBox1.Text = u.GetFileContent();
            label1.Text   = "公文標題:" + u.GetFileTitle();
            label6.Text   = "需修改內容:" + u.GetFFixContent();
        }
コード例 #4
0
        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            UpFile objsh2 = new UpFile();

            objsh2 = objsh2.Retrieveq(comboBox1.Text);

            label3.Text   = "公文標題:" + objsh2.GetFileTitle();
            textBox2.Text = objsh2.GetFileContent();
            textBox3.Text = objsh2.GetFFixContent();
        }