I'm pretty green at Delphi. I have a program that must call a MS SQL stored procedure before executing the rest of its logic. Here's the code I've written (changes have been made here and there to protect confidentiality):
theProcedure := TStoredProc.Create( NIL ) ;
theProcedure.DatabaseName := theTDatabase.DatabaseName ;
theProcedure.SessionName := theTDatabase.SessionName ;
theProcedure.StoredProcName := 'dbo.my_stored_proc' ;
theProcedure.Prepare;
theProcedure.ExecProc;
I get an error back that says: No parameter type for parameter ‘@Foo’
So I tried this
theProcedure := TStoredProc.Create( NIL ) ;
theProcedure.DatabaseName := theTDatabase.DatabaseName ;
theProcedure.SessionName := theTDatabase.SessionName ;
theProcedure.StoredProcName := 'dbo.my_stored_proc' ;
theProcedure.ParamByName('@Foo').AsString := 'bar' ;
theProcedure.Prepare;
theProcedure.ExecProc;
I then get an error that says "Parameter ‘@Foo’ not found"
I tried leaving off the @. Same error as above (sans the @ sign).
Google doesn't seem to help either. It's as frustrating as frustration can get. What am I doing wrong?