问题
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