rivkamak
asked on
Catch unable to login to mssql connection
I have an if-then statement to catch if I am unable to make a live connection to MSSQL database.
but I'm hitting an error now, that login is invalid.
Is there an if statement that will catch any of these too?
I only want my users to see the information once we are all connected.
but I'm hitting an error now, that login is invalid.
Is there an if statement that will catch any of these too?
I only want my users to see the information once we are all connected.
ASKER
This is my current script in ASp.
Where would I add that?
Where would I add that?
set myConn = Server.CreateObject("ADODB.Connection")
myConn.open MM_donorSelect_app1
if myConn.State = 1 then
response.write("First app is working")
stringUse = MM_donorSelect_app1
openConnection = true
end if
Since you are using vbscript, you would need to use OnError
I am not sure you get the same opportunity to catch the error in classic ASP like that.
I am not sure you get the same opportunity to catch the error in classic ASP like that.
ASKER
Any other ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Can you explain what happens when the user hits the error like login failed?
Will they get a MSSQL error, or will they just a response.write?
Can I just remove the response.write section and put a nice message like: You are unable to connect right now, please try again tommorow"
Will they get a MSSQL error, or will they just a response.write?
Can I just remove the response.write section and put a nice message like: You are unable to connect right now, please try again tommorow"
>>Can you explain what happens when the user hits the error like login failed?<<
Error message(s) will be displayed. Note: There could be more than one error message.
>>Will they get a MSSQL error, or will they just a response.write?<<
Both.
>>Can I just remove the response.write section and put a nice message like: You are unable to connect right now, please try again tommorow" <<
Of course. I am merely gave you the code so that you could produce custom messages in each case.
Error message(s) will be displayed. Note: There could be more than one error message.
>>Will they get a MSSQL error, or will they just a response.write?<<
Both.
>>Can I just remove the response.write section and put a nice message like: You are unable to connect right now, please try again tommorow" <<
Of course. I am merely gave you the code so that you could produce custom messages in each case.
catch (SQLException ex)
{
{