Can someone please help me on this problem. I am trying to send the updated changes to the sql database when I remove a row. I use the delete method to delete the numbered row through a dataview and then use the upate command to update the changes to the sql database. However, when I reload the program the rows are still there. Below is the current code I am using. This has been racking my brain for awhile now and any further help would be appreciated.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;

namespace MovieDiary
{
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
        public System.Windows.Forms.DataGrid dataGrid1;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        public System.ComponentModel.Container components = null;

        public static SqlConnection Mcon = new SqlConnection("Server=Homer;Database = Mov_Dbase;Integrated Security=SSPI; data source=\"Ho" +
            "mer\\SQLEXPRESS\"");
        //Capture the clicked cell
        private DataGrid.HitTestInfo hitTestGrid;
        public static SqlDataAdapter MovAdapt = new SqlDataAdapter(" SELECT * FROM MovTable1", Mcon);
        SqlCommandBuilder cb = new SqlCommandBuilder(MovAdapt);
        DataTableMapping myNewMapping =
            new DataTableMapping("MovMap", "MovTable1");
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button2;

        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.Button button7;
        private System.Windows.Forms.Button button8;
        private System.Windows.Forms.Button button9;
        private System.Windows.Forms.Button button10;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.Label label4;
        DataGridTextBoxColumn dataGridComboBox = new DataGridTextBoxColumn();
        DataGridTextBoxColumn dataGridComboBox2 = new DataGridTextBoxColumn();
        DataView Dv = new DataView();

        public static DataSet Movset1 = new DataSet("Movie List");

        Form2 frm2 = new Form2();





        //Define controls must be add to data grid.     
        private ComboBox cboControl = new ComboBox();
        private ComboBox cboControl2 = new ComboBox();

        //Control definishion to add to DataGrid
        DataGridTableStyle dataGridStyle = new DataGridTableStyle();

        //Create the TextBox columns for the datagrid columns
        DataGridTextBoxColumn aCol1 = new DataGridTextBoxColumn();
        DataGridTextBoxColumn aCol2 = new DataGridTextBoxColumn();
        DataGridTextBoxColumn aCol3 = new DataGridTextBoxColumn();
        DataGridTextBoxColumn aCol4 = new DataGridTextBoxColumn();
        //DataGridTextBoxColumn aCol6 = new DataGridTextBoxColumn();
        DataGridBoolColumn aCol6 = new DataGridBoolColumn();

        DataGridTextBoxColumn aCol5 = new DataGridTextBoxColumn();
        CheckBox chk1 = new CheckBox();
        public MessageBox MesBox;


        public string Movstring;
        public int CurRow = -1;
        public int CurCol = -1;
        public string CellValue;
        public bool strValue = false;
        private System.Windows.Forms.Button button11;
        private System.Windows.Forms.Button button12;
        private System.Windows.Forms.Button Findbtn;
        public System.Windows.Forms.Button UpdateSavebtn;
        public bool imageswitch;
        string Combostr;
        public int GblChkval = 0;
        public int ChkValTr = 0;
        public int ChkVAlFr = 0;
        public int StartValue = 1;
        private Button button1;
        private GroupBox groupBox1;
        public int ChkVal = 1;
        private Button button3;
        public static int UpdateVal = 0;



        public void Imagescrn()
        {
            this.BackgroundImage = Image.FromFile("C:\\Documents and Settings\\Mark\\My Documents\\My Pictures\\house_pg2.jpg");
        }
        public void ImageMain()
        {
            // this.BackgroundImage = Image.FromFile("C:\\Documents and Settings\\Mark\\My Documents\\My Pictures\\bg_page.jpg");
        }


        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            //Add combobox control to datagrid.
            dataGridComboBox.TextBox.Controls.Add(cboControl);
            cboControl.Items.AddRange(new string[8] { "", "Horror", "Action/Thriller", "TV/Series", "Sci-fi/Fantasy", "Family", "Drama", "Comedy" });

            dataGridComboBox2.TextBox.Controls.Add(cboControl2);
            cboControl2.Items.AddRange(new string[3] { "", "DVD", "Blue-Ray" });

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();
            this.dataGrid1 = new System.Windows.Forms.DataGrid();
            this.UpdateSavebtn = new System.Windows.Forms.Button();
            this.label1 = new System.Windows.Forms.Label();
            this.button2 = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            this.button4 = new System.Windows.Forms.Button();
            this.button5 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.button7 = new System.Windows.Forms.Button();
            this.button8 = new System.Windows.Forms.Button();
            this.button9 = new System.Windows.Forms.Button();
            this.button10 = new System.Windows.Forms.Button();
            this.label3 = new System.Windows.Forms.Label();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.Findbtn = new System.Windows.Forms.Button();
            this.button11 = new System.Windows.Forms.Button();
            this.button12 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
            this.SuspendLayout();
            // 
            // dataGrid1
            // 
            this.dataGrid1.AccessibleDescription = "public";
            this.dataGrid1.AllowDrop = true;
            this.dataGrid1.ColumnHeadersVisible = ((bool)(configurationAppSettings.GetValue("dataGrid1.ColumnHeadersVisible", typeof(bool))));
            this.dataGrid1.DataMember = ((string)(configurationAppSettings.GetValue("dataGrid1.DataMember", typeof(string))));
            this.dataGrid1.ForeColor = System.Drawing.SystemColors.ActiveCaption;
            this.dataGrid1.HeaderBackColor = System.Drawing.Color.WhiteSmoke;
            this.dataGrid1.HeaderForeColor = System.Drawing.Color.Black;
            this.dataGrid1.Location = new System.Drawing.Point(152, 128);
            this.dataGrid1.Name = "dataGrid1";
            this.dataGrid1.ReadOnly = ((bool)(configurationAppSettings.GetValue("dataGrid1.ReadOnly", typeof(bool))));
            this.dataGrid1.RowHeaderWidth = 0;
            this.dataGrid1.SelectionBackColor = System.Drawing.SystemColors.Info;
            this.dataGrid1.Size = new System.Drawing.Size(575, 232);
            this.dataGrid1.TabIndex = 0;
            this.dataGrid1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dataGrid1_MouseUp);
            this.dataGrid1.CurrentCellChanged += new System.EventHandler(this.dataGrid1_CurrentCellChanged);
            // 
            // UpdateSavebtn
            // 
            this.UpdateSavebtn.BackColor = System.Drawing.Color.Silver;
            this.UpdateSavebtn.Location = new System.Drawing.Point(312, 376);
            this.UpdateSavebtn.Name = "UpdateSavebtn";
            this.UpdateSavebtn.Size = new System.Drawing.Size(128, 32);
            this.UpdateSavebtn.TabIndex = 1;
            this.UpdateSavebtn.Text = "Update And Save";
            this.UpdateSavebtn.UseVisualStyleBackColor = false;
            this.UpdateSavebtn.Click += new System.EventHandler(this.UpdateSavebtn_Click_1);
            // 
            // label1
            // 
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.Location = new System.Drawing.Point(264, 16);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(208, 40);
            this.label1.TabIndex = 2;
            this.label1.Text = "MovieBase";
            this.label1.Click += new System.EventHandler(this.label1_Click);
            // 
            // button2
            // 
            this.button2.BackColor = System.Drawing.Color.Silver;
            this.button2.ForeColor = System.Drawing.Color.ForestGreen;
            this.button2.Location = new System.Drawing.Point(715, 381);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(64, 32);
            this.button2.TabIndex = 4;
            this.button2.Text = "Exit";
            this.button2.UseVisualStyleBackColor = false;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // label2
            // 
            this.label2.BackColor = System.Drawing.Color.Silver;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.Red;
            this.label2.Location = new System.Drawing.Point(8, 128);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(136, 24);
            this.label2.TabIndex = 7;
            this.label2.Text = "List By Category";
            this.label2.Click += new System.EventHandler(this.label2_Click);
            // 
            // button4
            // 
            this.button4.BackColor = System.Drawing.Color.Silver;
            this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.button4.Font = new System.Drawing.Font("Blackadder ITC", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button4.ForeColor = System.Drawing.Color.DarkBlue;
            this.button4.Location = new System.Drawing.Point(8, 152);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(136, 32);
            this.button4.TabIndex = 8;
            this.button4.Text = "Horror";
            this.button4.UseVisualStyleBackColor = false;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            // 
            // button5
            // 
            this.button5.BackColor = System.Drawing.Color.Silver;
            this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.button5.Font = new System.Drawing.Font("Rockwell", 8.3F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button5.ForeColor = System.Drawing.Color.DarkBlue;
            this.button5.Location = new System.Drawing.Point(8, 280);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(136, 32);
            this.button5.TabIndex = 9;
            this.button5.Text = "Family/Entertainment";
            this.button5.UseVisualStyleBackColor = false;
            this.button5.Click += new System.EventHandler(this.button5_Click);
            // 
            // button6
            // 
            this.button6.BackColor = System.Drawing.Color.Silver;
            this.button6.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.button6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button6.ForeColor = System.Drawing.Color.DarkBlue;
            this.button6.Location = new System.Drawing.Point(8, 184);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(136, 32);
            this.button6.TabIndex = 10;
            this.button6.Text = "Action/Thriller";
            this.button6.UseVisualStyleBackColor = false;
            this.button6.Click += new System.EventHandler(this.button6_Click);
            // 
            // button7
            // 
            this.button7.BackColor = System.Drawing.Color.Silver;
            this.button7.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.button7.Font = new System.Drawing.Font("Impact", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button7.ForeColor = System.Drawing.Color.DarkBlue;
            this.button7.Location = new System.Drawing.Point(8, 248);
            this.button7.Name = "button7";
            this.button7.Size = new System.Drawing.Size(136, 32);
            this.button7.TabIndex = 11;
            this.button7.Text = "Sci-Fi/Fantasy";
            this.button7.UseVisualStyleBackColor = false;
            this.button7.Click += new System.EventHandler(this.button7_Click);
            // 
            // button8
            // 
            this.button8.BackColor = System.Drawing.Color.Silver;
            this.button8.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.button8.Font = new System.Drawing.Font("Perpetua", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button8.ForeColor = System.Drawing.Color.DarkBlue;
            this.button8.Location = new System.Drawing.Point(8, 312);
            this.button8.Name = "button8";
            this.button8.Size = new System.Drawing.Size(136, 32);
            this.button8.TabIndex = 12;
            this.button8.Text = "Drama";
            this.button8.UseVisualStyleBackColor = false;
            this.button8.Click += new System.EventHandler(this.button8_Click);
            // 
            // button9
            // 
            this.button9.BackColor = System.Drawing.Color.Silver;
            this.button9.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.button9.Font = new System.Drawing.Font("Perpetua", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button9.ForeColor = System.Drawing.Color.DarkBlue;
            this.button9.Location = new System.Drawing.Point(8, 216);
            this.button9.Name = "button9";
            this.button9.Size = new System.Drawing.Size(136, 32);
            this.button9.TabIndex = 13;
            this.button9.Text = "TV/Series";
            this.button9.UseVisualStyleBackColor = false;
            this.button9.Click += new System.EventHandler(this.button9_Click);
            // 
            // button10
            // 
            this.button10.BackColor = System.Drawing.Color.Silver;
            this.button10.Location = new System.Drawing.Point(176, 376);
            this.button10.Name = "button10";
            this.button10.Size = new System.Drawing.Size(120, 32);
            this.button10.TabIndex = 14;
            this.button10.Text = "Back To Main List";
            this.button10.UseVisualStyleBackColor = false;
            this.button10.Click += new System.EventHandler(this.button10_Click);
            // 
            // label3
            // 
            this.label3.BackColor = System.Drawing.Color.Silver;
            this.label3.Location = new System.Drawing.Point(8, 40);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(104, 23);
            this.label3.TabIndex = 15;
            this.label3.Text = "Search Movie";
            // 
            // textBox1
            // 
            this.textBox1.Location = new System.Drawing.Point(8, 64);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(100, 20);
            this.textBox1.TabIndex = 16;
            this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
            // 
            // label4
            // 
            this.label4.BackColor = System.Drawing.Color.Silver;
            this.label4.Location = new System.Drawing.Point(8, 88);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(104, 16);
            this.label4.TabIndex = 17;
            this.label4.Text = "Enter Title";
            // 
            // Findbtn
            // 
            this.Findbtn.BackColor = System.Drawing.Color.Silver;
            this.Findbtn.Location = new System.Drawing.Point(112, 64);
            this.Findbtn.Name = "Findbtn";
            this.Findbtn.Size = new System.Drawing.Size(56, 24);
            this.Findbtn.TabIndex = 18;
            this.Findbtn.Text = "Find";
            this.Findbtn.UseVisualStyleBackColor = false;
            this.Findbtn.Click += new System.EventHandler(this.Findbtn_Click);
            // 
            // button11
            // 
            this.button11.BackColor = System.Drawing.Color.Silver;
            this.button11.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.button11.Font = new System.Drawing.Font("Papyrus", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button11.ForeColor = System.Drawing.Color.DarkBlue;
            this.button11.Location = new System.Drawing.Point(8, 344);
            this.button11.Name = "button11";
            this.button11.Size = new System.Drawing.Size(136, 32);
            this.button11.TabIndex = 19;
            this.button11.Text = "Comedy";
            this.button11.UseVisualStyleBackColor = false;
            // 
            // button12
            // 
            this.button12.Location = new System.Drawing.Point(152, 104);
            this.button12.Name = "button12";
            this.button12.Size = new System.Drawing.Size(80, 23);
            this.button12.TabIndex = 20;
            this.button12.Text = "Display List";
            this.button12.Click += new System.EventHandler(this.button12_Click);
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(731, 12);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(48, 23);
            this.button1.TabIndex = 21;
            this.button1.Text = "Help";
            this.button1.UseVisualStyleBackColor = true;
            // 
            // button3
            // 
            this.button3.Location = new System.Drawing.Point(460, 376);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(75, 32);
            this.button3.TabIndex = 22;
            this.button3.Text = "Delete  Movie";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click_1);
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.BackColor = System.Drawing.Color.DarkRed;
            this.ClientSize = new System.Drawing.Size(791, 446);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.button12);
            this.Controls.Add(this.button11);
            this.Controls.Add(this.Findbtn);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.button10);
            this.Controls.Add(this.button9);
            this.Controls.Add(this.button8);
            this.Controls.Add(this.button7);
            this.Controls.Add(this.button6);
            this.Controls.Add(this.button5);
            this.Controls.Add(this.button4);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.UpdateSavebtn);
            this.Controls.Add(this.dataGrid1);
            this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.3F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.KeyPreview = true;
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.Enter += new System.EventHandler(this.Form1_Enter);
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.Run(new Form1());
        }




        public void Form1_Load(object sender, System.EventArgs e)
        {
            //Add a new table style to datagrid.
            DesignTableStyle();
            dataGrid1.RowHeadersVisible = true;
            dataGrid1.DataSource = Movset1;
            MovAdapt.Fill(Movset1, "MovTable1");
            dataGrid1.DataSource = Movset1;



            aCol6.AllowNull = false;
            label1.Show();

            Show();
            dataGrid1.Show();




        }

        //Add a new table style to datagrid.
        private void DesignTableStyle()
        {
            dataGridStyle.PreferredRowHeight = 24;
            dataGridStyle.MappingName = "MovTable1";

            //
            // Create GridColumnStyle objects for the grid columns
            //          

            aCol1.HeaderText = "Item No";
            aCol1.MappingName = "Number";
            aCol2.Width = 50;
            dataGridStyle.GridColumnStyles.Add(aCol1);

            dataGrid1.TableStyles.Add(dataGridStyle);


            aCol2.HeaderText = "Title";
            aCol2.MappingName = "Title";
            aCol2.Width = 100;
            dataGridStyle.GridColumnStyles.Add(aCol2);


            dataGridComboBox.HeaderText = "Category";
            dataGridComboBox.MappingName = "Category";
            dataGridComboBox.Width = 125;
            dataGridStyle.GridColumnStyles.Add(dataGridComboBox);

            aCol4.HeaderText = "Discs";
            aCol4.MappingName = "Discs";
            aCol4.Width = 100;
            dataGridStyle.GridColumnStyles.Add(aCol4);

            dataGridComboBox2.HeaderText = "Version";
            dataGridComboBox2.MappingName = "Version";
            dataGridComboBox2.Width = 125;
            dataGridStyle.GridColumnStyles.Add(dataGridComboBox2);

            aCol6.HeaderText = "Boxset";
            aCol6.MappingName = "Boxset";
            aCol6.Width = 100;
            dataGridStyle.GridColumnStyles.Add(aCol6);



           /* aCol7.HeaderText = "Delete";

            aCol7.Width = 100;
            dataGridStyle.GridColumnStyles.Add(aCol7);*/



        }


        private void label1_Click(object sender, System.EventArgs e)
        {

        }



        private void button2_Click(object sender, System.EventArgs e)
        {
            this.Close();

        }

        private void button3_Click(object sender, System.EventArgs e)
        {

        }

        private void label2_Click(object sender, System.EventArgs e)
        {

        }

        private void button4_Click(object sender, System.EventArgs e)
        {
            dataGrid1.Hide();
            label1.Hide();
            Imagescrn();
            Dv = new DataView(Movset1.Tables[0]);
            dataGrid1.DataSource = Dv;
            Dv.RowFilter = "Category = 'HORROR'";
        }

        private void button6_Click(object sender, System.EventArgs e)
        {
            Dv = new DataView(Movset1.Tables[0]);
            dataGrid1.DataSource = Dv;
            Dv.RowFilter = "Category = 'Action/Thriller'";
        }

        private void button8_Click(object sender, System.EventArgs e)
        {
            label1.Hide();
            this.BackgroundImage = Image.FromFile("C:\\Documents and Settings\\Mark\\My Documents\\My Pictures\\drama_pg.jpg");
            Dv = new DataView(Movset1.Tables[0]);
            dataGrid1.DataSource = Dv;
            Dv.RowFilter = "Category = 'Drama'";
        }

        private void button5_Click(object sender, System.EventArgs e)
        {
            Dv = new DataView(Movset1.Tables[0]);
            dataGrid1.DataSource = Dv;
            Dv.RowFilter = "Category = 'Family/Entertainment'";
        }

        private void button7_Click(object sender, System.EventArgs e)
        {
            label1.Hide();
            this.BackgroundImage = Image.FromFile("C:\\Documents and Settings\\Mark\\My Documents\\My Pictures\\scifi_pg.jpg");
            Dv = new DataView(Movset1.Tables[0]);
            dataGrid1.DataSource = Dv;
            Dv.RowFilter = "Category = 'Sci-Fi/Fantasy'";
        }

        private void button9_Click(object sender, System.EventArgs e)
        {
            Dv = new DataView(Movset1.Tables[0]);
            dataGrid1.DataSource = Dv;
            Dv.RowFilter = "Category = 'TV/Series'";
        }

        private void button10_Click(object sender, System.EventArgs e)
        {

            ImageMain();
            dataGrid1.RowHeadersVisible = true;
            dataGrid1.DataSource = Movset1;
            label1.Show();
            Show();
        }


        private void textBox1_TextChanged(object sender, System.EventArgs e)
        {
            Movstring = textBox1.ToString();
        }

        private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)
        {
            int CurrnCol = dataGrid1.CurrentCell.ColumnNumber;
            CurCol = dataGrid1.CurrentCell.ColumnNumber;
            CurRow = dataGrid1.CurrentCell.RowNumber;
            dataGrid1.RowHeadersVisible = false;
            // int Currncol = 0;
            // Currncol = dataGrid1.CurrentCell.ColumnNumber;


            if (CurrnCol == 2)
            {

                if (cboControl.DroppedDown = true)
                {
                    this.cboControl.Leave += new EventHandler(cboControl_Leave);


                }


            }
            if (CurrnCol == 4)
            {

                if (cboControl2.DroppedDown = true)
                {

                    this.cboControl2.Leave += new EventHandler(cboControl2_Leave);


                }
            }

            /*if (CurCol == 5)
            {

                string Chkvalue = dataGrid1[CurRow, CurCol - 1].ToString();
                if(Chkvalue == "")
                {
                    dataGrid1[CurRow, CurCol] = false;
                    GblChkval = false;
                    return;


                }                  

            }*/



        }

        private void cboControl_Leave(object sender, EventArgs e)
        {
            Combostr = cboControl.SelectedItem.ToString();
            dataGrid1[CurRow, CurCol] = Combostr;

            //CurRow = 0;
            // CurCol = 0;


        }

        private void cboControl2_Leave(object sender, EventArgs e)
        {

            Combostr = cboControl2.SelectedItem.ToString();
            dataGrid1[CurRow, CurCol] = Combostr;
            //CurRow = 0;
            //CurCol = 0;            


        }
        void CheckBoxOnCheckedChanged(object obj, EventArgs ea)
        {
            dataGrid1[CurRow, CurCol] = ((CheckBox)obj).Checked;
            Invalidate(false);
        }



        private void chk1_Leave(object sender, EventArgs e)
        {

            if (chk1.Checked == true)
            {
                dataGrid1[CurRow, CurCol] = Visible;

            }
            else
                dataGrid1[CurRow, CurCol] = false;


            // CurRow = 0;
            //CurCol = 0;
            return;


        }








        private void Form1_Enter(object sender, System.EventArgs e)
        {
            dataGrid1.RowHeadersVisible = true;

        }

        private void button12_Click(object sender, System.EventArgs e)
        {

            dataGrid1.Show();

        }

        private void Findbtn_Click(object sender, System.EventArgs e)
        {
            Dv = new DataView(Movset1.Tables[0]);
            dataGrid1.DataSource = Dv;
            Dv.RowFilter = "Title ='" + textBox1.Text + "'";
            if (textBox1.Text == "")
            {
                MessageBox.Show("Search failed: Movie Title has not been entered!! ");
                return;
            }

            if (Dv.Count < 1)
            {
                MessageBox.Show("Movie does not exist in MovieBase, please try again");
            }

        }

        private void UpdateSavebtn_Click_1(object sender, System.EventArgs e)
        {
            Mcon.Open();
            UpdateVal = 1;
            if (UpdateVal == 0)
            {
                CurCol = dataGrid1.CurrentCell.ColumnNumber;
                CurRow = dataGrid1.CurrentCell.RowNumber;
                CellValue = dataGrid1[CurRow, CurCol].ToString();
                MessageBox.Show(CellValue.ToString());


                if (CellValue == "")
                {

                    MessageBox.Show("No Fields can be Blank - update failed");
                    Movset1.RejectChanges();
                    ImageMain();
                    CurRow = -1;
                    CurCol = -1;

                    Mcon.Close();
                    return;

                }
                CellValue = dataGrid1[CurRow, CurCol].ToString();
                CurRow = -1;
                CurCol = -1;
            }


            MovAdapt.UpdateCommand = cb.GetUpdateCommand();
            MovAdapt.Update(Movset1.Tables[0]);
            Movset1.AcceptChanges();


            MessageBox.Show("New movie added");

            Mcon.Close();
            UpdateVal = 0;

            dataGrid1.RowHeadersVisible = true;
        }

        private void dataGrid1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {

            hitTestGrid = dataGrid1.HitTest(e.X, e.Y);
            if (CurCol == 5)
            {


                    switch (ChkVal)
                    {
                        case 1:
                            ChkVal = 1;
                            dataGrid1[CurRow, CurCol] = false;
                            break;
                        case 2:
                            ChkVal = 2;
                            dataGrid1[CurRow, CurCol] = true;
                            break;                   
                        default:                           
                            break;
                    }

                            if (ChkVal == 1)
                            {
                                ChkVal = 2;
                            }
                            else
                            {
                                ChkVal = 1;
                            }




            }
        }



        private void button13_Click(object sender, EventArgs e)
        {




        }



        private void button3_Click_1(object sender, EventArgs e)
        {
            frm2.Show();

        }


    }
}


















































using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data.Common;

namespace MovieDiary
{
    public partial class Form2 : Form
    {

        DataView Dv2 = new DataView();
        public DataSet ds2 = new DataSet();
        public static Form1 F1 = new Form1();
        SqlDataAdapter Da2 = new SqlDataAdapter();
        public static int DelVal = 0;
        SqlCommandBuilder cb2 = new SqlCommandBuilder();

        void DSMethod()
        {

            ds2 = Form1.Movset1;
            //Da2 = Form1.MovAdapt;
            Form1.UpdateVal = 1;





        }

        public Form2()
        {

            InitializeComponent();

        }

        public void Form2_Load(object sender, System.EventArgs e)
        {

        }        

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show(" Please enter a title to be deleted ");
                return;             
            }



               DSMethod();
               Dv2 = new DataView(ds2.Tables[0]);
               F1.dataGrid1.DataSource = Dv2;
               Dv2.RowFilter = "Title ='" + textBox1.Text + "'";

               if (Dv2.Count < 1)
               {
                   MessageBox.Show("Movie does not exist in MovieBase, please try again");
                   return;
               }
               else
               {

                   int rownum = (F1.dataGrid1.CurrentCell.RowNumber);
                   Dv2.Delete(rownum);

                   ds2.AcceptChanges();
                   //MovAdapt.UpdateCommand = cb.GetUpdateCommand();
                   //MovAdapt.Update(Movset1.Tables[0]);

                   this.Hide();

                     //Dv2.Table.Rows.Remove(Dv2.Table.Rows.current)

                   MessageBox.Show("Movie has been deleted");

               }





        }
    }
}

A data adapter should have four commands:
1) Select -> to retrieve the data and used in the fill of a datatable
2) Insert -> to put the new rows into the database
3) Update -> to update the row content in the database, and
4) Delete -> to remove the deleted rows from the database.

As far as I can see in your code, only the SELECT and the UPDATE commands are defined for the data adapter.

Hope this helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.