How does Navision execute Stored Procedure in Nav SQL DB?

jemmy
Member Posts: 247
Dear Folks,
A little question:
Anyone could explain to me briefly, better with a few examples. :?
Still reading chapter 3 in Navision Solution Dev....
Thanks in advance,
Jemmy
A little question:
How does Navision execute Stored Procedure in Navision SQL DB?
Anyone could explain to me briefly, better with a few examples. :?
Still reading chapter 3 in Navision Solution Dev....
Thanks in advance,
Jemmy
0
Comments
-
Hi Jemmy,
I I understand correctly, you want to execute an sp from an SQL Server.
I will write a quick example of connecting, getting an sp from a db, executing and displaying some data:Automation variables: autSQLServer 'Microsoft SQLDMO Object Library'.SQLServer autDatabases 'Microsoft SQLDMO Object Library'.Databases autDB 'Microsoft SQLDMO Object Library'.Database autStoredProcedures 'Microsoft SQLDMO Object Library'.StoredProcedures autSP 'Microsoft SQLDMO Object Library'.StoredProcedure res 'Microsoft SQLDMO Object Library'.QueryResults the code you could use: CREATE(autSQLServer); autSQLServer.Connect(servername, username, password); //get databases autDatabases:=autSQLServer.Databases; //get first db (master) autDB:=autDatabases.ItemByID(1); //get stored procedures list autStoredProcedures:=autDB.StoredProcedures; //find the dt_verstamp006 stored procedure i:=1; WHILE autStoredProcedures.Item(i).Name <> 'dt_verstamp006' DO i:=i+1; autSP:=autStoredProcedures.Item(i); res:=autDB.ExecuteWithResults(autSP.Name); MESSAGE(res.GetColumnString(1,1)); autSQLServer.DisConnect; autSQLServer.Close; CLEARALL;
0 -
Hi Arhontis,
This is great, buddy!
Thanks, I think you are very good on these.. (you write quickly) :!:
I'll try and let you know the result...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions