3
Answers

Syntax error in UPDATE statement in C Sharp

Smith Joseph

Smith Joseph

14y
6.3k
1
Give me better solution as early as possible....


strquery = "UPDATE Item_Master SET Display_Name = '" + txtDisplay_Name.Text + "', Item_Category ='" + cmbCategory.Text + "', Item_SubCategory ='" + cmbSub_category.Text + "', Standard_UOM ='" + cmbStandard_UOM.Text + "' , Item_Description = '" + txtDescription.Text + "', Package = '" + cmbPackage.Text + "', Units_per_pack = " + txtUnits_Per_Pack.Text + ", Color ='" + txtcolor.Text + "', Size='" + txtsize.Text + "',Company='" + txtcompany.Text + "', Model_No='" + txtmodel_no.Text + "', Manufacturer_Lot_No='" + txtmfg_lot_no.Text + "', MRP=" + txtmrp.Text + ", Manufacturing_Date='" + mfg_dt.ToShortDateString() +", Expiry_Date = '" + exp_dt.ToShortDateString() + "', Unit_Cost=" + txtUnit_Cost.Text + ", Unit_Price=" + txtUnit_Price.Text + ", Item_Default_Location='" + cmbDefault_Location.Text + "', Default_Supplier='" + cmbDefault_Supplier.Text + "', Item_Re_Order_Level=" + txtitem_reorder_level.Text + ", Item_Min_Level=" + txtitem_min_level.Text + ", Item_Max_Level=" + txtitem_max_level.Text + ", Item_Status='" + cmbItem_Status.Text + "', Item_Remarks='" + txtitem_remark.Text + "' Where Item_Code='" + cmbItem_Code.Text + "'";
mycmd = new OleDbCommand(strquery, conn);
            conn.Open();
            mycmd.ExecuteNonQuery();
            MessageBox.Show("Data Updated Successfully...","Item Update",MessageBoxButtons.OK);
            conn.Close();
Answers (3)