Menu

#1 ADO Stored Procedure Causes future failures

Current
open
5
2004-10-20
2004-10-20
No

The following procedures illustrate the problem:
--------------------
-- Initialize_Bad --
--------------------
procedure Initialize_Bad
is
Command_Text: GString := "EXECUTE My_Stored_Procdure";

begin
Execute(MY_SQL_Server_Database, Command_Text);
end Initialize__Bad;

---------------------
-- Initialize_Good --
---------------------
procedure Initialize_Good
is
Command: uCommand_Type;
Unused_Pointer: Pointer_To_uRecordset;
Command_Text: String := "EXECUTE My_Stored_Procdure";

begin
Create(Command, ADO.CLSID_Command);
PutRef_ActiveConnection(Command,
Pointer(My_SQL_Server_Database.Connection));
Put_CommandText(Command, To_BSTR(Command_Text));

Unused_Pointer := Execute (
Command,
Options => 0
);

end Initialize_Good;

Initialize_Bad does work in the sense that it does cause the
execution
of the stored procedure. The problem is that any subsequent
attempt to
do anything that communicates with the database fails; it seems to
close
the connection. Initialize_Good is a workaround that solves the
problem.
It has to be in a child package of GWindows.Databases .

Discussion