[D7 Ent] [TADOStoredProc] lose and get back network connexion it still raise exceptionl
- From: "aaa.aaaa" <aaa.aaa@xxxxxxx>
- Date: Fri, 27 Jan 2006 17:05:44 +0100
Hi All,
I have a problem with TADOStoredProc
If I lose the network the system raise an exception, (General Network Error) It is ok !!
But when i get back the network connexion, the system still raise an exception (Connexion failure).
The TADOConnection is created only the first time (singleton)
my procedure to test it :
1- I execute the test one time with network ; Result OK
2- I unplug my network cable , run the test ; Result = General Network Error exception OK
3- I plug back the cable, run the test ; Result = Connection Failure exception ; WHY ?
If I create the TADOConnection each time it works fine, but i don't want to do that !!!
If i use an proc stock with params, the system raise exception because is cannot find the params when i get back the network ?
How can i fix that ?
I don't want to close the application each time the system lose and get back the network connexion
With TADOQuery is working fine !!
Thanks !!!
See under my code source
Unit ADONetworkTest
........
type
TCnxFailureTests = class(TTestCase)
private
protected
published
// Test methods
procedure TestFailureCnxStoredProcWithoutParams2;end;
implementation
var _Cmd:TADOConnection;
function GetCmd: TADOConnection;
begin
if _Cmd = nil then
begin
_Cmd:= TADOConnection.Create(Nil);
_Cmd.ConnectionString:= 'Provider=SQLOLEDB.1;Persist Security'
+ 'Info=True;User ID=sa;Initial Catalog=Northwind;'
+ 'Data Source=MYSERVER\DEV';
_Cmd.LoginPrompt:= False;
end;
Result:= _Cmd;
end;
procedure TCnxFailureTests.TestFailureCnxStoredProcWithoutParams2; var _SP: TADOStoredProc; begin
_SP:= TADOStoredProc.Create(Nil);
try
_SP.Connection:= GetCmd;
_SP.ProcedureName := 'dbo.SP_TEST';
_SP.ExecProc;
Check(_SP.Connection.Connected , 'Error Falure Cnx');
finally
FreeAndNil(_SP);
end;end; .
- Follow-Ups:
- Prev by Date: TADOQuery.Open() & Sybase
- Next by Date: Re: [D7 Ent] [TADOStoredProc] lose and get back network connexion it still raise exceptionl
- Previous by thread: TADOQuery.Open() & Sybase
- Next by thread: Re: [D7 Ent] [TADOStoredProc] lose and get back network connexion it still raise exceptionl
- Index(es):
Relevant Pages
|