public static bool Update(DOChonPhongVan ChonPhongVan) { try { string sql = "UPDATE BANG_CHON_PV SET " + "NAME = @NAME " + "WHERE ID = @ID"; DatabaseFB db = DABase.getDatabase(); DbCommand cmd = db.GetSQLStringCommand(sql); db.AddInParameter(cmd, "@ID", DbType.Int64, ChonPhongVan.getID()); db.AddInParameter(cmd, "@NAME", DbType.String, ChonPhongVan.getName()); int iCmd = db.ExecuteNonQuery(cmd); if (iCmd > 0) return true; return false; } catch (Exception ex) { throw new Exception(ex.Message); } }
public static bool Insert(DOChonPhongVan ChonPhongVan) { try { string sql = "INSERT INTO BANG_CHON_PV " + "(ID,NAME) VALUES " + "(@ID,@NAME)"; DatabaseFB db = DABase.getDatabase(); DbCommand cmd = db.GetSQLStringCommand(sql); db.AddInParameter(cmd, "@ID", DbType.Int64, ChonPhongVan.getID()); db.AddInParameter(cmd, "@NAME", DbType.String, ChonPhongVan.getName()); int iCmd = db.ExecuteNonQuery(cmd); if (iCmd > 0) return true; return false; } catch (Exception ex) { throw new Exception(ex.Message); } }