public void update(MatHangDTO info) { string updateCommand = "UPDATE MatHang " + "SET TenMatHang = '" + info.TenMatHang + "', " + " DonViTinh = '" + info.DonViTinh + "', " + " DonGia = '" + info.DonGia + "', " + " WHERE MaMatHang = '" + info.MaMatHang + "'"; executeNonQuery(updateCommand); }
protected override object GetDataFromDataRow(DataTable dt, int i) { MatHangDTO mh = new MatHangDTO(); mh.MaMatHang = dt.Rows[i]["MaMatHang"].ToString(); mh.TenMatHang = dt.Rows[i]["TenMatHang"].ToString(); mh.DonViTinh = dt.Rows[i]["DonViTinh"].ToString(); mh.DonGia = int.Parse(dt.Rows[i]["DonGia"].ToString()); return (object)mh; }
public void insert(MatHangDTO info) { string insertCommand = "INSERT INTO MatHang VALUES('" + info.MaMatHang + "', '" + info.TenMatHang + "', '" + info.DonViTinh + "', '" + info.DonGia + ")"; executeNonQuery(insertCommand); }