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

SQL Server - Reconnect

$
0
0

Hi all,

 

In the old version of our application which used the MSS native driver for the SQL Server, when the connection to the server was lost (eg the network card was configured to have a tight power management) after the eror message we had code to reconnect to the SQL Server.

 

After we migrated to newer versions of PB that they were not using the MSS (we are using the SNC now and SQL Server 2005/2008R2/2012) we cannot find a way to reconnect without having to restart our application.

 

I wrote this code but it does not fire

 

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

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

  DISCONNECT;

  CONNECT;

End If

 

I hope my description is not very vague.


I found the same issue asked by a guy here

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=103765

but no answer was given.

 

Thanx in advance!

 

EDIT: I think that the problem lies in the fact that SQLCA.SQLDBCode instead of giving me 10005 or 10025, it returns -1

Why doesn't it return the SQL Server error code?


Viewing all articles
Browse latest Browse all 8526

Trending Articles



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