Reporting Service 2000 表示式語句的一點疑惑
阿新 • • 發佈:2019-01-27
最近在學習用Reporting Service 作報表,沒想到僅支援VB的表示式 (那位知道其它的表示式,或者有支援語法的幫助文件,那“感謝天,感謝地,感謝……” 給我一份吧)我那個心顫……
想寫這麼個提示資訊:頁面輸入兩個查詢引數BeginTime, EndTime 當這兩個引數為空值“”時,頁面提示當前月的第一天到最後一天,效果:2007年4月1日 至 2007年4月30日,如果輸入查詢引數則顯示輸入的時間,使用的表示式:
IIF(Parameters!BeginTime.Value <>"",Format(DateSerial(Year(Parameters!BeginTime.Value),Month(Parameters
Format(DateSerial(Year(Globals!ExecutionTime),Month( Globals!ExecutionTime ),1) ,"yyyy年M月d日") )
&" 至 "&
IIF(Parameters!EndTime.Value <>"",
Format(DateSerial(Year( Parameters!EndTime.Value ),Month( Parameters!EndTime.Value ),Day( Parameters
Format(DateSerial(Year(Globals!ExecutionTime),Month( Globals!ExecutionTime )+1,1-1) ,"yyyy年M月d日"))
沒想到,IIF(expr,truepart,falsepart)居然是不管表示式expr返回的true 還是false 居然都會去計算truepart和falsepart,這樣就總會出現空值強制轉換的問題,那自然是報錯了。
後來一想,能不能用三目運算子,結果一試居然說:表示式裡面不能出現“:”,沒有“:”的三目運算子沒見過當然也不知道怎麼用^_^,只好罷了,想想CSDN上潛龍遊鳳頗多,拋磚引玉 望高人指點,小生先謝過