Why empty cell throws an error during SQL stored procedure execution

后端 未结 4 848
再見小時候
再見小時候 2021-01-28 01:50
SELECT
    CAST ([content_html] AS XML).query(\'/root/Physicians/specialty/a\') AS [Specialty1]
    , CAST ([content_html] AS XML).query(\'/root/Physicians/specialty2/a\         


        
4条回答
  •  粉色の甜心
    2021-01-28 02:34

    You can add something like this to the code behind of the page:

    protected object MyEval(string expression)
    {
        object o = null;
        try
        {
            o = DataBinder.Eval(this.GetDataItem(), expression);
        }
        catch
        {
            o = System.String.Empty;
        }
        return o;
    }
    

    and then replace all Evals with "MyEval":

    <%# MyEval("Specialty1").ToString() + DisplayMultiplMyEvalues(MyEval("Specialty2").ToString()) + DisplayMultiplMyEvalues(MyEval("Specialty3").ToString()) + DisplayMultiplMyEvalues(MyEval("Specialty4").ToString()) + DisplayMultiplMyEvalues(MyEval("Specialty5").ToString()) + DisplayMultiplMyEvalues(MyEval("Specialty6").ToString()) %>
    

提交回复
热议问题