コード例 #1
0
ファイル: mainForm.cs プロジェクト: BSUIR350531/polinkov
        private void btnEdit_Click(object sender, EventArgs e)
        {
            Film f = new Film();

            f.FilmTitle = txtTitle2.Text;
            f.FilmGenre = txtGenre2.Text;
            f.FilmCountry = txtCountry2.Text;
            f.FilmProducer = txtProducer2.Text;
            f.FilmYear = txtYear2.Text;
            f.InfoRent = cmbInfoRent2.Text;
            f.InRent = txtInRent2.Text;
            f.OverRent = txtOverRent2.Text;

            f.ID = selectedFilmID;
            c.Update(f);
        }
コード例 #2
0
ファイル: Conn.cs プロジェクト: BSUIR350531/polinkov
        public void Insert(Film f)
        {
            try
            {
                command.CommandText = "INSERT INTO TFilms (FilmTitle, FilmGenre, FilmCountry, FilmProducer, FilmYear, InfoRent, InRent, OverRent) VALUES('" + f.FilmTitle + "', '" + f.FilmGenre + "', '" + f.FilmCountry + "', '" + f.FilmProducer + "', '" + f.FilmYear + "', '" + f.InfoRent + "', '" + f.InRent + "', '" + f.OverRent + "')";
                command.CommandType = System.Data.CommandType.Text;
                connection.Open();

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if(connection != null)
                {
                    connection.Close();
                }
            }
        }
コード例 #3
0
ファイル: Conn.cs プロジェクト: BSUIR350531/polinkov
        public void Update(Film f)
        {
            try
            {
                command.CommandText = "UPDATE [TFilms] SET [TFilms].FilmTitle= '" +f.FilmTitle+ "', [TFilms].FilmGenre= '" +f.FilmGenre+ "', [TFilms].FilmCountry= '" +f.FilmCountry+ "', [TFilms].FilmProducer= '" +f.FilmProducer+ "', [TFilms].FilmYear= '" +f.FilmYear+ "', [TFilms].InfoRent= '" +f.InfoRent+ "', [TFilms].InRent= '" +f.InRent+"', [TFilms].OverRent= '" +f.OverRent+"' WHERE [TFilms].ID = " +f.ID+ "";
                command.Parameters.Add(new OleDbParameter("ID", f.ID));
                command.CommandType = System.Data.CommandType.Text;
                connection.Open();

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
コード例 #4
0
ファイル: Conn.cs プロジェクト: BSUIR350531/polinkov
        public void Delete(Film f)
        {
            try
            {
                command.CommandText = "DELETE FROM TFilms WHERE ID= " + f.ID;
                command.Parameters.Add(new OleDbParameter("ID", f.ID));
                command.CommandType = System.Data.CommandType.Text;
                connection.Open();

                command.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
コード例 #5
0
ファイル: mainForm.cs プロジェクト: BSUIR350531/polinkov
        private void btnInsert_Click(object sender, EventArgs e)
        {
            Film f = new Film();
            f.FilmTitle = txtTitle.Text;
            f.FilmGenre = txtGenre.Text;
            f.FilmCountry = txtCountry.Text;
            f.FilmProducer = txtProducer.Text;
            f.FilmYear = txtYear.Text;
            f.InfoRent = cmbInfoRent.Text;
            f.InRent = txtInRent.Text;
            f.OverRent = txtOverRent.Text;

            c.Insert(f);
        }
コード例 #6
0
ファイル: mainForm.cs プロジェクト: BSUIR350531/polinkov
 private void btnDelete_Click(object sender, EventArgs e)
 {
     Film f = new Film();
     f.ID = selectedFilmID;
     c.Delete(f);
 }