我正在尝试使用可以为空的日期时间值调用存储过程,但是我正在用这个圈子运行。您可以在下面看到我尝试过的所有组合以及相关错误:
FromDate = Excel.CurrentWorkbook(){[Name="FromDate"]}[Content]{0}[Column1],
FromDateQuery = if FromDate = "" then "" else "@FromDate = '"& DateTime.From(FromDate)&"',",
Expression.Error: We cannot apply operator & to types Text and DateTime.
Details:
Operator=&
Left=@FromDate = '
Right=15/03/2017 00:00:00
如果我按照说明操作,请删除&建议我得到以下内容: Expression.SyntaxError:Token Comma expect。
尝试将其作为字符串传递:
FromDate = Excel.CurrentWorkbook(){[Name="FromDate"]}[Content]{0}[Column1],
FromDateQuery = if FromDate = "" then "" else "@FromDate = '"& Text.From(FromDate) &"',",
Message =将数据类型varchar转换为datetime时出错。
查询:
[Query="EXECUTE dbo.bsp_GetReport
"& UserQuery &"
"& FromDateQuery &"]
还尝试使用Cast和Convert all徒劳......
答案 0 :(得分:2)
您可以使用具有所需格式的DateTime.ToText,例如
<md-slide-toggle (change)="changeToggle($event, activityType.isActive)" checked="activityType.isActive" value="activityType.activityTypeId" mdTooltip="{{!!activityType.isActive ? 'Active' : 'Inactive'}}" mdTooltipPosition="left"></md-slide-toggle>
public changeToggle(event: MdSlideToggleChange, originalValue){
if (this.hasChange && event.checked !== originalValue){
event.stopPropagation();
//Results in error: [ts] Property 'stopPropagation' does not exist on type 'MdSlideToggleChange'.
} else {
this.hasChange = !this.hasChange;
}
}