sjn21682 0 Newbie Poster

hi there, need some help here, i am adding data to my access database, my add button is fine but what i wanted to do is to type directly in my DataGridView, not in textbox, as what is happening in my program, hope you could help me... thank you in advance

private void btnAdd_Click(object sender, EventArgs e)
        {

            MyCmd1.CommandText =
                "INSERT INTO Replicate VALUES('" + txtProj.Text + "', '" + txtRep1.Text + "', '" + txtRep2.Text + "', '" + txtRep3.Text + "', '" + txtRep4.Text + "', '" + txtMonth.Text + "', '" + txtYear.Text + "', '" + txtDataDIR.Text + "', '" + txtDic.Text + "')";

           try
            {
                int row_affected = MyCmd1.ExecuteNonQuery();
                MessageBox.Show(row_affected.ToString() + " row affected.", "Insert command result");
                txtMonth.Clear();
                txtProj.Clear();
                txtRep1.Clear();
                txtRep2.Clear();
                txtRep3.Clear();
                txtRep4.Clear();
                txtYear.Clear();
                txtDataDIR.Text = "C:\ " ;
                Refresh1();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            MyCmd1.CommandText =
                "DELETE INTO Replicate VALUES ('" + txtProj.Text + "', '" + txtRep1.Text + "', '" + txtRep2.Text + "', '" + txtRep3.Text + "', '" + txtRep4.Text + "', '" + txtMonth.Text + "', '" + txtYear.Text + "', '" + txtDataDIR.Text + "', '" + txtDic.Text + "')";
             // i dont know if my code here is right
            
            try
            {
                int row_affected = MyCmd1.ExecuteNonQuery();
                MessageBox.Show(/* " row affected.",*/ "Delete command result");
                txtMonth.Clear();
                txtProj.Clear();
                txtRep1.Clear();
                txtRep2.Clear();
                txtRep3.Clear();
                txtRep4.Clear();
                txtYear.Clear();
                txtDataDIR.Text = "C:\ " ;
                Refresh1();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

       public void Refresh1()
        {
            string commandString = "Select * from Replicate";
            MyDataAdapter1 = new OleDbDataAdapter(commandString, MyCon1);

            DataSet ds = new DataSet();
            MyDataAdapter1.Fill(ds, "Replicate");
            MyDataTable = ds.Tables["Replicate"];

            dGV1.DataSource = ds.Tables["Replicate"];
        }