sending an error message from SQL to the browser

五迷三道 提交于 2019-12-24 22:07:42

问题


I have a stored procedure for checking business rules in a holiday booking system but I need it to return error messages if it fails so far I have been using if statements and the else(my error is in the else) looks as follows:

    BEGIN
        SELECT 'Error1'
    END

im using ASP adodb connection (apprentice in training) and this is how im trying to retrieve it:

     if not objDBRS.EOF then
        Session("Error") = objDBRS(0)
            if Session("Error") = "Error1" Then
                Response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert(""you cannot book more than 10 days off"")</SCRIPT>")
            End If
end if

Currently it works correctly the stored procedure and doesn't do the code if it fails but the error is not returned to the browser for some reason so it doesn't hit the ASP if statement. so it works just doesn't get the client side JS message.

来源:https://stackoverflow.com/questions/22345937/sending-an-error-message-from-sql-to-the-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!