Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect to SqlServer without error message

Status
Not open for further replies.

Kongsjs

Programmer
Jul 20, 2007
17
NO
Hi

I am makeing a program that should run 24/7 on it's own.
In this program I need to connect to 2 different SqlServer databases, and all this works well.
The problem appears when one of the SqlServers are down or someting else goes wrong when I connect to the SqlServer.
I then get a MessageBox with the error message, and then the connection prompt.

The question is: How do I get rid of this messagebox and the connection prompt ?
I want to just check the SqlCode to see if something has gone wrong, and then send a SMS to my Cell phone, so I can fix the problem.

Anyone that know how this is done i PowerBuilder 7.0.3 ?
 
First of all you should check SQLCode after connect to database.
If messagebox still appears try to use SystemError event and try to catch the error there.

Tomek
 
The problem is that the messagebox appears on the "Connect" statement, so I never get down to the "If" I have after the connect.

Connect;
if sqlca.sqlcode <> 0 then

I guess there must be some way of turning of getting the messagebox/prompt, but I dont know how.
 
1. What is your sqlca params definition script before "connect" command?

2. Look into PB help on "Try...Catch" syntax. Maybe it helps you to catch an error.

Tomek
 
I don't think PB7 had 'Try Catch'

Matt

"Nature forges everything on the anvil of time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top