CodePudding user response:
You judge the sqlca. Sqlcode not to go,CodePudding user response:
How to judge? Code to write? Not always must determine when?CodePudding user response:
I remember I used to be such a figureDw_1. Settransobject (sqlca)
Change
Dw_1. Settrans (sqlca)
You don't have to consider connection problems
Give it a try ~
CodePudding user response:
????? Has this happened?CodePudding user response:
The best way is to call a Windows PINGBut the code is more complex
Online there are many such examples
If you have a firewall be fluent but
/* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
* test server is running, the return value description
1 workstation is not installed SQLDMO
Server object cannot be obtained - 2
- 3 Server is not installed SQL Server 2000
1 has launched
2 stop
3 stop
4 start ing
5 stop ing
Six other
* connect PB requirements: the return value is equal to or less than or equal to 1 4, try to connect
* New By Njz 2006-07-16
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
String ls_user ls_password, ls_rtn
Long li_rtn
Oleobject ole_server
Return 1
Li_rtn=1
Ole_server=Create oleobject
Li_rtn=ole_server. ConnectToNewObject (" SQLDMO. Essentially ")
If li_rtn & lt;> 0 Then
The Return - 1
End the If
Ole_server. Name=as_server
Ole_server. Logintimeout=3
If IsNull (ole_server) Then
The Return - 2
End the If
Try
Li_rtn=ole_server. Status
The Catch (RunTimeError rte)
Li_rtn=3
End the Try
Destroy ole_server
Return li_rtn
CodePudding user response:
IF the sqlca. Sqlcode=10005 then
Connect using the sqlca;
End If
CodePudding user response:
Dw_1. Settrans (sqlca)When they retrieve or update data connection, of course will have an impact on performance
CodePudding user response:
Writing the code in the Windows of the timer event,Determine disconnected already said a lot of way upstairs.
If the disconnect the heavy chain automatically.
CodePudding user response:
Bumps!!!!!!CodePudding user response:
Script should write what place? Written in the timer is wrong, maybe more time to implement the timer event, very affect the efficiency? Do you have any special write SQL errors, SQL once error will execute the script, or just write in the event of an error and then to judge the wrong type? If written in the error then you should write in the error which window? MDI? Each window to write?CodePudding user response:
Call the winsock ping server capabilities to determine whether broken network.Script execution best judgement on the press before each control key. For example: the new, open, etc. If every time is long to input documents, often broken network.
Can have two methods. One is in each itemchanged event ping server (super stupid). Another is to add a save the function of the datawindow content to a file, if broken network cannot be saved when save, keep the data into the computer, back to back and then continue to import these data entry.
CodePudding user response:
Call the winsock ping server capabilities to determine whether broken network.Script execution best judgement on the press before each control key. For example: the new, open, etc. If every time is long to input documents, often broken network.
Can have two methods. One is in each itemchanged event ping server (super stupid). Another is to add a save the function of the datawindow content to a file, if broken network cannot be saved when save, keep the data into the computer, back to back and then continue to import these data entry.
CodePudding user response:
Ping is not the best way to build some antivirus software will not let ping, but the client can even, PB has no unified error events and error code?I mean, once in application error will trigger the event, is only triggered when something goes wrong, don't like a TIMER from time to time to perform, then according to the error code to determine whether SQL disconnect
CodePudding user response: