none
C# ACCES TO ACCES DB DATA TRANSFER ERROR RRS feed

  • Genel Tartışma

  • ı received error. please help me. edit my code.

    Error CS7036 There is no argument given that corresponds to the required formal parameter 'cell' of 'karsit.InsertRow(OleDbConnection, string)'

     private void emptyperiodadd()
            {
                string hedef = System.Windows.Forms.Application.StartupPath + "\\tutanaklar\\" + FF3.Text + "_" + altcombo.Text + "_" +
                comboBox3.Text + "-" + textBox15.Text + "_" + SS7.Text + "-" + SS8.Text
                 + "_" + SS9.Text + "-" + SS10.Text + "_" + comboBox3.Text + ".mdb";

                OleDbConnection connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + hedef);
                connection.Open();

                OleDbCommand olddelete = new OleDbCommand("DELETE FROM kdv WHERE ID", connection);
                olddelete.ExecuteNonQuery();


                for (int i = 1; i <= 1000 && (invoice.RowCount > i); i++)
                {
                    InsertRow(invoice.Rows[i].Cells[1].Value.ToString());
                }
            }

            void InsertRow(OleDbConnection conn, string cell)
            {
                DateTime month;
                if (DateTime.TryParseExact(cell, "MM.yyyy", null, DateTimeStyles.None, out month))
                {
                    InsertMonth(month.AddMonths(-1));
                    InsertMonth(month);
                }
            }

            void InsertMonth(DateTime month)
            {
                string hedef = System.Windows.Forms.Application.StartupPath + "\\tutanaklar\\" + FF3.Text + "_" + altcombo.Text + "_" +
               comboBox3.Text + "-" + textBox15.Text + "_" + SS7.Text + "-" + SS8.Text
                           + "_" + SS9.Text + "-" + SS10.Text + "_" + comboBox3.Text + ".mdb";

                using (var conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + hedef))
                using (var cmd = conn.CreateCommand())
                {
                    cmd.Connection.Open();
                    cmd.CommandText = "insert into kdv (a) values (?)";
                    cmd.Parameters.AddWithValue("?", month.ToString("MM/yyyy"));
                    cmd.ExecuteNonQuery();
                }
            }

    2 Ağustos 2017 Çarşamba 12:03