Calling Stored Procedures

Hello,

I’m new to Navision and I would like to know how to call a SQL server stored procedure from a navision form and/or report.

Thanks you very much

Giovanni Michielin

I guess it could be done, but don’t.

You should write the code in C/SIDE in the Navision application at the table level. Navision deos not integrate with SQL in this way.

David,

I thought it should have been done in a Codeunit as the Stored procedure has nothing to do at table level.

I would like to run a Stored Procedure just by clicking on a standard BUTTON in a base Navision Form.

Thanks

Giovanni

I don’t know whyI you need stored procedures. I guest you know what you are doing. A possible answer is in http://www.mibuso.com/forum/viewtopic.php?t=5515

There is not a generic answer to this, it depends what you are trying to do. In general though code should be either at the Table or CodeUnit level, depending on what it does.

Code on Forms and Reports is used ONLY for formating purposes. (With a couple of exceptions). Of course this does not apply to Batch jobs (aka non printing reports).

one more mibuso thread about same topic.
http://www.mibuso.com/forum/viewtopic.php?t=9995&highlight=stored+procedure+parameter

Also on Tools CD for Navision, you have objects for Index Defragment which are using SQL orders. Objects are in 50000 range. Fob for import is under Performance folder I think.

There, in one CU you’ll find very clean code for connection to SQL through ADO and for executing prepared SQL orders so I strongly advice to, at least, read through that piece of code.

That’s what I was looking for.

Thank you very much.

Giovanni