Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8436

Re: SQL Server - Reconnect

$
0
0

I did a little test. I loged into my app.

Then I disconnected physically from the LAN.

I clicked to start an operation which fired a function that called a stored procedure

 

I will put some code here in case anyone spots something fishy

 

The function:

DECLARE C PROCEDURE FOR pr_check_phase

@id = :ad_id;

 

EXECUTE C; //here it tries to execute but there is no connection to the server so the f_db_error below fires

 

IF f_db_error() = -1 Then

  CLOSE C;

  Return FALSE;

End If

 

 

The code of uf_db_error

If SQLCA.SQLDBCode = 10005 OR SQLCA.SQLDBCode = 10025 Then

  MessageBox("Info","Click on OK To Reconnect!")

  DISCONNECT;

  CONNECT;

  If f_db_error() = -1 Then

       MessageBox("Error","Reconnect failed! Please restart the application!",StopSign!)

  Else

       MessageBox("Info","Reconnection succeded!")

  End If

End If

 

It never gets inside the first IF clause because the SQLCA.SQLDBCode is -1


Viewing all articles
Browse latest Browse all 8436

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>