Дополнительная информация: синтаксическая ошибка (отсутствует оператор) в выражении запроса '@phone no'.
когда я вставляю данные, я получаю такую ошибку
Additional information: Syntax error (missing operator) in query expression '@Phone No'.
Что я уже пробовал:
for (int i = 0; i < dataGridView21.Rows.Count; i++) { OleDbCommand command = new OleDbCommand(); command.Connection = connection; command.CommandText = @"insert into Total ([Column1],[Column2],[Column3],[Date],[Receipt No],[Delivery Person],[Report],[Flavours],[Name],[Phone No]) VALUES(@Column1, @Column2, @Column3, @Date, @ReceiptNo, @DeliveryPerson, @Report, @Flavours, @Name , @Phone No)"; //values('" + dataGridView21.Rows[i].Cells[0].Value.ToString() + "','" + dataGridView21.Rows[i].Cells[1].Value.ToString() + "','" + txtDisplay.Text + "','" + label4.Text + "','" + label2.Text + "','" + label128.Text + "'," + dataGridView21.Rows[i].Cells[0].Value.ToString() + ",'" + dataGridView21.Rows[i].Cells[3].Value.ToString() + "','" + dataGridView21.Rows[i].Cells[5].Value.ToString() + "','" + dataGridView21.Rows[i].Cells[6].Value.ToString() + "');"; connection.Open(); for (int j = 0; j < dataGridView21.Rows.Count; j++) { var row = dataGridView21.Rows[j]; if (row.IsNewRow) continue; command.Parameters.Clear(); command.Parameters.AddWithValue("@Column1", row.Cells[0].Value); command.Parameters.AddWithValue("@Column2", row.Cells[1].Value); command.Parameters.AddWithValue("@Column3", txtDisplay.Text); command.Parameters.AddWithValue("@Date", label4.Text); command.Parameters.AddWithValue("@ReceiptNo", label2.Text); command.Parameters.AddWithValue("@DeliveryPerson", label128.Text); command.Parameters.AddWithValue("@Report", row.Cells[0].Value); command.Parameters.AddWithValue("@Flavours", row.Cells[3].Value); command.Parameters.AddWithValue("@Name", row.Cells[5].Value); command.Parameters.AddWithValue("@Phone No", row.Cells[6].Value); command.ExecuteNonQuery(); } connection.Close(); } //printreceiptod(); flpCategories.Enabled = false; flpProducts.Enabled = false; listBox20.Focus(); MessageBox.Show("Inserted Sucessfully", dataGridView21.Rows.Count + " " + "ITEMS", MessageBoxButtons.OK, MessageBoxIcon.Information); listBox20.Focus(); dataGridView21.Rows.Clear(); label128.Text = "Delivery"; while (listBox20.Items.Count > 0) { button64.PerformClick(); } flpCategories.Enabled = true; }