public bool Insert(NHAPKHOTHEONGAY nktn) { try { _cn.Open(); string SQL = "INSERT INTO NHAPKHOTHEONGAY VALUES ('" + nktn.MASP + "',N'" + nktn.TENSP + "',N'" + nktn.SOLUONGNHAP + "', '" + nktn.TIENNHAP + "','" + nktn.TONGTIEN + "','" + nktn.THOIGIANNHAP + "')"; SqlCommand cmd = new SqlCommand(SQL, _cn); cmd.ExecuteNonQuery(); _cn.Close(); return(true); } catch { return(false); } }
public bool Update(NHAPKHOTHEONGAY nktn) { try { SqlDataAdapter da = new SqlDataAdapter("select * from NHAPKHOTHEONGAY", _cn); DataRow r = dt.Rows.Find(nktn.MASP.ToString()); if (r != null) { r["TENSP"] = nktn.TENSP; // r["SOLUONGNHAP"] = nk.SOLUONGNHAP; r["TIENNHAP"] = nktn.TIENNHAP; r["TONGTIEN"] = nktn.TONGTIEN; } SqlCommandBuilder cm = new SqlCommandBuilder(da); da.Update(dt); return(true); } catch { return(false); } }
public bool Update(NHAPKHOTHEONGAY nktn) { return(NKTN.Update(nktn)); }
public bool Insert(NHAPKHOTHEONGAY nktn) { return(NKTN.Insert(nktn)); }