Witam,
mam problem z wstawieniem danych do bazy MYSQL.
string StrQuery1;
try
{
using (MySqlConnection conn1 = new MySqlConnection(connectionString))
{
using (MySqlCommand comm1 = new MySqlCommand())
{
comm1.Connection = conn1;
conn1.Open();
comm1.Parameters.AddWithValue("@d_wy", DateTime.Today);
comm1.Parameters.AddWithValue("@d_wa", dateTimePicker_oferta_datawaznoscioferty.Value.Date);
comm1.Parameters.AddWithValue("@im_kl", comboBox_oferta_klient_imienazwisko.Text);
comm1.Parameters.AddWithValue("@na_fir_kl", comboBox_oferta_klient_nazwafirmy.Text);
comm1.Parameters.AddWithValue("@im_pr", comboBox_imie_pracownika.Text);
comm1.Parameters.AddWithValue("@ma_pr",textBox_mail_pracownika.Text);
comm1.Parameters.AddWithValue("@tl_pr",textBox_tel_pracownika.Text);
comm1.Parameters.AddWithValue("@ty_of",textBox_tytuloferty.Text);
comm1.Parameters.AddWithValue("@ce_net_wsz",textBox_oferta_cenanettolacznie.Text);
comm1.Parameters.AddWithValue("@ce_bru_wsz",textBox_oferta_cenabruttolacznie.Text);
for (int j = 0; j < dataGridView_oferta.Rows.Count - 1; j++)
{
StrQuery1 = @"INSERT INTO current (d_wy , d_wa , im_kl , na_fir_kl , im_pr ,ma_pr, tl_pr , ty_of , na_pro , il , ce_net_szt , ce_net_lac , ce_net_wsz , ce_bru_wsz) VALUES (@d_wy , @d_wa , @im_kl , @na_fir_kl , @im_pr ,@ma_pr , @tl_pr , @ty_of , '" + dataGridView_oferta.Rows[j].Cells["Opis"].Value + "','" + dataGridView_oferta.Rows[j].Cells["Ilosc"].Value + "','" + Convert.ToString(dataGridView_oferta.Rows[j].Cells["CenaNettoSzt"].Value).Replace(',', '.') + "','" + Convert.ToString(dataGridView_oferta.Rows[j].Cells["CenaNettoLacznie"].Value).Replace(',', '.') + "';";
comm1.CommandText = StrQuery1;
comm1.ExecuteNonQuery();
}
conn1.Close();
}
}
}
Dostaje błąd, że jest problem w linijce w której jest insert.