public void UpdateSale_Order_PD(int lgIndex, SqlCommand cmd, MSale_Order_PD model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Sale_Order_PD set "); strSql.Append("F_LR=@F_LR,"); strSql.Append("LensCode=@LensCode,"); strSql.Append("LensCodeR=@LensCodeR"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@F_LR", SqlDbType.VarChar, 1), new SqlParameter("@LensCode", SqlDbType.NVarChar, 50), new SqlParameter("@LensCodeR", SqlDbType.NVarChar, 50), new SqlParameter("@ID", SqlDbType.VarChar, 25) }; parameters[0].Value = model.F_LR; parameters[1].Value = model.LensCode; parameters[2].Value = model.LensCodeR; parameters[3].Value = model.ID; cmd.ExecuteMyQuery(strSql.ToString(), parameters); }
public void AddSale_Order_PD(int lgIndex, SqlCommand cmd, MSale_Order_PD model) { StringBuilder strSql = new StringBuilder(); SqlParameter[] parameters = null; strSql.Append("insert into Sale_Order_PD("); strSql.Append("ID,F_LR,LensCode,LensCodeR,InvTitle)"); strSql.Append(" values ("); strSql.Append("@ID,@F_LR,@LensCode,@LensCodeR,@InvTitle)"); parameters = new SqlParameter[] { new SqlParameter("@ID", SqlDbType.VarChar, 25), new SqlParameter("@F_LR", SqlDbType.VarChar, 1), new SqlParameter("@LensCode", SqlDbType.NVarChar, 50), new SqlParameter("@LensCodeR", SqlDbType.NVarChar, 50), new SqlParameter("@InvTitle", SqlDbType.NVarChar, 100) }; parameters[0].Value = model.ID; parameters[1].Value = model.F_LR; parameters[2].Value = model.LensCode; parameters[3].Value = model.LensCodeR; parameters[4].Value = model.InvTitle; cmd.ExecuteMyQuery(strSql.ToString(), parameters); }