Home > database >  Detection of SQL server error, please master
Detection of SQL server error, please master

Time:09-23

The HTML code is as follows, advice on how to return an error, please master

PBObject=CREATE OLEObject
Ll_return=PBObject. ConnectToNewObject (" SQLDMO. Essentially ")
IF ll_return=0 THEN//connection success
PBObject. Name=ls_servername
Try
Ll_status=PBObject. Status
The Catch (RunTimeError rte)
Messagebox (' prompt ', 'server specified is invalid, the server name: + ls_servername, StopSign!)
If IsValid (PBObject) then
PBObject. DisconnectObject ()
Destroy PBObject
End the if
End the try
If ll_status=2 then//SQL Server to hold
PBObject. Continue ()
Elseif ll_status=3 then//SQL Server to stop state
PBObject. Start (false, ls_servername, "bypos", "bypos")//Start the SQL Server
End the if
The else
Messagebox (" prompt ", "not installed SQL Server Server or SQL Server system has been damaged!" )
If IsValid (PBObject) then
PBObject. DisconnectObject ()
Destroy PBObject
End the if
The return - 1
End the if
If IsValid (PBObject) then
PBObject. DisconnectObject ()
Destroy PBObject
end if

CodePudding user response:

To what's wrong?

CodePudding user response:

A, determine whether the permissions enough; If Windows 7 is to right-click on the application as an administrator to run;
Two, determine SQLDMO component installation is successful, the code must run on the server, the client is not SQLDMO;
Three, you'd better add a try in the periphery

CodePudding user response:

To what's wrong? Measurement, quite normal, see PB8's advice
  • Related