Thank you, I have solved my problem
private void btn_all_Click(object sender, EventArgs e)
{
try
{
connect_data();
byte[] imageBt = null;
for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
string STT = dataGridView1.Rows[i].Cells["STT"].Value.ToString();
string Ngay_nhap = dataGridView1.Rows[i].Cells["Ngày nhập"].Value.ToString();
string Ten_thiet_bi = dataGridView1.Rows[i].Cells["Tên thiết bị"].Value.ToString();
string Nha_san_xuat = dataGridView1.Rows[i].Cells["Nhà sản xuất"].Value.ToString();
string Don_vi = dataGridView1.Rows[i].Cells["Đơn vị"].Value.ToString();
string So_luong = dataGridView1.Rows[i].Cells["Số lượng"].Value.ToString();
string Nhan_tu = dataGridView1.Rows[i].Cells["Nhận từ"].Value.ToString();
string Chip_ID = dataGridView1.Rows[i].Cells["Chip ID"].Value.ToString();
string MAC_address = dataGridView1.Rows[i].Cells["MAC address"].Value.ToString();
string SN = dataGridView1.Rows[i].Cells["SN"].Value.ToString();
string Ghi_chu = dataGridView1.Rows[i].Cells["Ghi chú"].Value.ToString();
string Ngay_xuat = "";
string Ngay_nhan_lai = "";
string Query = "INSERT into nhap_2015 (STT,Ngay_nhap,Ten_thiet_bi,Nha_san_xuat,Don_vi,So_luong,Nhan_tu,Chip_ID,MAC_address,SN,Ghi_chu,Hinh,Ngay_xuat,Ngay_nhan_lai) values ('" + STT + "','" + Ngay_nhap + "','" + Ten_thiet_bi + "','" + Nha_san_xuat + "','" + Don_vi + "','" + So_luong + "','" + Nhan_tu + "','" + Chip_ID + "','" + MAC_address + "','" + SN + "','" + Ghi_chu + "',@hinh,'" + Ngay_xuat + "','" + Ngay_nhan_lai + "');";
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDatabase);
MySqlDataReader myReader;
try
{
conDatabase.Open();
cmdDataBase.Parameters.Add(new MySqlParameter("@hinh", imageBt));
myReader = cmdDataBase.ExecuteReader();
while (myReader.Read())
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
conDatabase.Close();
}
MessageBox.Show("ADD COMPLETED");
}
catch
{
MessageBox.Show("Error!!!!!");
}
}