在这里,我尝试将行esmcost
的值与表psmcost
的{{1}}进行比较,但wsmtbl
费用值为esmcost
,因此我我收到以下错误:
运营商'<>'未定义类型' DBNull'并输入' DBNull'
有没有办法将空值更改为零?
这是C#代码
null
答案 0 :(得分:1)
尝试以下方法。
import 'rxjs/add/operator/mergeMap'; // can be refactored to pipe + operator
import {of} from 'rxjs/observable/of';
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
return this.checkLogin(route);
}
checkLogin(route): Observable<boolean> {
return this.authService.login().mergeMap(_=> {
if (this.authService.isAuth) {
return this.authService.grants().map(grants => grants.canRead ? true : false)
}else{
return of(false);
}
});
}
}
可以使用三元运算符语法,但出于可读性原因,我选择了上述语法。例如:
$arr = json_encode($jsonstr);
答案 1 :(得分:0)
试试这个,
if(ds.Tables["wsmtbl"].Rows[0]["esmcost"] == DBNull.Value)
{
ds.Tables["wsmtbl"].Rows[0]["esmcost"] = 0;
}
ds.Tables["wsmtbl"].Rows[0]["esmcost"] != ds.Tables["wsmtbl"].Rows[0]["psmcost"];