for (int rows = 0; rows < dgvDescription.Rows.Count; rows++)
{
string description = dgvDescription.Rows[rows].Cells["description"].Value.ToString();
string size = dgvDescription.Rows[rows].Cells["size"].Value.ToString();
string materialname = dgvDescription.Rows[rows].Cells["materialname"].Value.ToString();
string noofcolor = dgvDescription.Rows[rows].Cells["colorprinting"].Value.ToString();
string mode = dgvDescription.Rows[rows].Cells["mode"].Value.ToString();
string qty = dgvDescription.Rows[rows].Cells["qty"].Value.ToString();
string qty_uom = dgvDescription.Rows[rows].Cells["quom"].Value.ToString();
string weight = dgvDescription.Rows[rows].Cells["weight"].Value.ToString();
string weight_uom = dgvDescription.Rows[rows].Cells["wuom"].Value.ToString();
string rate = dgvDescription.Rows[rows].Cells["rate"].Value.ToString();
string amount = dgvDescription.Rows[rows].Cells["amount"].Value.ToString();
string option = dgvDescription.Rows[rows].Cells["option"].Value.ToString();
int r = rows + 1;
int o = 0;
if (option == "Qty")
{
o = 2;
}
else if (option == "Wt")
{
o = 1;
}
string mquery = "insert into IBS_DC_DTLS(DC_No,Sl_No,Description,Size,Material_Name,Noof_Color,Mode,Quantity,Qty_UOM,Weight,Weight_UOM,Multi_Opt,Rate,Amount) values('" + dcno + "','" + r + "','" + description + "','" + size + "','" + materialname + "','" + noofcolor + "','" + mode + "','" + qty + "','" + qty_uom + "','" + weight + "','" + weight_uom + "','" + o + "','" + rate + "','" + amount + "')";
SqlCommand mcmd = new SqlCommand(mquery, con);
mcmd.ExecuteNonQuery();
}
No comments:
Post a Comment