Re: Delphi 7 Ent. TADOStoredProc
- From: mike <aaaa.aaaa@xxxxxxxx>
- Date: Fri, 17 Feb 2006 22:49:38 +0100
Hi all ,
I would like to know why when I am using a TADOStoredProc the first time
is work well but the next time i got this trace from the SQL profiler:
First call :
Audit Login -- network protocol: LPC
set quoted_identifier on
set implicit_transactions off
set cursor_close_on_commit off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set language us_english
set dateformat mdy
set datefirst 7
RPC:Completed
declare @P1 int set @P1=11 exec dbo.SP_TEST_ADD_TEN 1, @P1 output select @P1
Second call :
SQL:BatchCompleted
SET NO_BROWSETABLE ON
SQL:BatchCompleted
SET FMTONLY ON EXEC dbo.SP_TEST_ADD_TEN 0,0 SET FMTONLY OFF
SQL:BatchCompleted
SET NO_BROWSETABLE OFF
RPC:Completed
declare @P1 int set @P1=12 exec dbo.SP_TEST_ADD_TEN 2, @P1 output select @P1
..... it's the same for each others call
bellow the delphi code
type
TCashierTests = class(TTestCase)
private
protected
//procedure SetUp; override;
//procedure TearDown; override;
published
// Test methods
procedure TestSpAdo;
end;
implementation
var
m_SP: TADOStoredProc;
_Cmd: TADOConnection;
iTest:Integer;
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=Jeux;Data Source=MSSERVER2K\TEST';
_Cmd.LoginPrompt := False;
_Cmd.Open;
end;
Result := _Cmd;
end;
function GetSpAddTen: TADOStoredProc;
begin
if m_SP = nil then
begin
m_SP := TADOStoredProc.Create(nil);
m_SP.Connection:= GetCmd;
m_SP.ProcedureName := 'dbo.SP_TEST_ADD_TEN';
With m_SP.Parameters.AddParameter do
begin
DataType :=ftInteger;
Direction :=pdInput;
Name:= '@MyNUMBER';
end;
With m_SP.Parameters.AddParameter do
begin
DataType :=ftInteger;
Direction :=pdOutput;
Name:= '@RES';
end;
end;
Result := m_SP;
end;
{ TCashierTests }
procedure TCashierTests.TestSpAdo;
begin
GetSpAddTen.Parameters.ParamByName('@MyNUMBER').Value:= iTest;
GetSpAddTen.ExecProc;
Check( GetSpAddTen.Parameters.ParamByName('@RES').Value = (iTest+10) ,'Error on ADD');
Inc(iTest);
end;
.
- References:
- Delphi 7 Ent. TADOStoredProc
- From: aaa.aaaa
- Delphi 7 Ent. TADOStoredProc
- Prev by Date: Delphi 7 Ent. TADOStoredProc
- Next by Date: Re: ADO and MDAC issues on XP systems
- Previous by thread: Delphi 7 Ent. TADOStoredProc
- Index(es):
Relevant Pages
|