I am needing to convert a large amount of SQL queries into stored procedures. I have some code that updates about 20 or 30 values at one time in one Delphi procedure. I can
This doesn't cause a memory leak. stored_procedure will clean up its parameters. You can confirm this with FastMM by adding the following to your .dpr:
ReportMemoryLeaksOnShutdown := True;
First, I'd get rid of the "with" statement. It can lead to more problems and less readable code.
I'd create a helper method that accepts a stored procedure, a parameter name and a parameter value, which will make your code more manageable.
AddParam(stored_procedure, '@SSN', edtSSN.text);
AddParam(stored_procedure, '@FirstName', edtFirstName.Text);
AddParam(stored_procedure, '@LastName', edtLastName.Text);
AddParam(stored_procedure, '@UserRID', GetRIDFromCombo(cbUser));