Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Try...except not working

Status
Not open for further replies.

troyu

Programmer
Nov 21, 2000
185
CA
My Try..Except statement is not working. I am trying to execute stored procedures on the SQL Server, but it is not running.

Code Snipit:

Try
Form_GL.ClearBnkProc.Prepare;
Form_GL.ClearBnkProc.Execproc;
except

The code always drops out at the "execproc" stage, and goes into the exception (the except). Is there anything that the "try" needs in order to execute the execproc?
 
I just did a simple Stored proc, selecting * from a table.

Then I added one TADOConnection and made the connection.
I added one TADOStoredProc and changed the "Connection" and "ProcedureName" property to the right values.

Then I added the following code, and that works fine:

ADOConnection1.Connected := true;

try
ADOStoredProc1.ExecProc;
ShowMessage('Success!!!');
except
ShowMessage('Exception');
end;

ADOConnection1.Connected := false;


Did you do the same or???

Andreas Nordlund
Software developer
 
No, I did not do the same. I am using Delphi 1.0. I am not using ADO.
 
Ahhh, you wrote that in another post, sorry.

The only thing I can come up with right now, is that the database connection has been opened for Table reading or something like that.

I've heard that erlier versions of Delphi and SQL Server had problems to execute stored procedures, but this is only a bad rumor...



Andreas Nordlund
Software developer
 
So if the database connection is open for reading, such as a

Table1.Active := true

then the EXECPROC will not work?
 
Do you know the answer to my previous post?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top