Calling SQL Server 2005 Stored Procedures

shibily
Member Posts: 89
Hi,
I am new to Navision, I have SQL server Knowledge.
Can anyone please tell me how to call a storedprocedure from
Navision.. Which are the global variables i need to create..
Thanks in advance
Shibily.
I am new to Navision, I have SQL server Knowledge.
Can anyone please tell me how to call a storedprocedure from
Navision.. Which are the global variables i need to create..
Thanks in advance
Shibily.
0
Answers
-
Search the forum for "ADO Connection" or take a look into this tool http://www.mibuso.com/forum/viewtopic.php?t=23204
Here you can see, how to connect to SQL Server with C/AL Code and execute SQL Commands (Select, backup, EXEC YourProcedur,etc)
RegardsDo you make it right, it works too!0 -
[Topic moved from Navision forum to SQL General forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Or have a look at www.waldo.be. This explains into details.0
-
8)
I have put it on Tips&Tricks on this site as well: Using ADO & Stored Procedures in C/SIDE
But indeed, here is the link to my (identical) blogpost.
Hope it's useful.0 -
Waldo,
I tried ur code , But i am getting an error message..
I used the follwing code in a button Push event.
IF ISCLEAR(LADOConnection) THEN CREATE(LADOConnection);
LADOConnection.ConnectionString:='Driver={SQL Server}; Server=VMWIN2K3\SQLEXPRESS;Database =astDB;Uid=sa;pwd=ast';
LADOConnection.Open;
IF ISCLEAR(lADOCommand) THEN
CREATE(lADOCommand);
lvarActiveConnection := LADOConnection;
lADOCommand.ActiveConnection := lvarActiveConnection;
lADOCommand.CommandText := 'SP_testShib';
lADOCommand.CommandType := 4;
lADOCommand.CommandTimeout := 0;
lADOCommand.Execute;
LADOConnection.Close;
CLEAR(LADOConnection);
I got 2 errors.
Error1 is :- " The Call to member Execute failed. Could not find Stored procedure 'SP_testShib'.
But i have created a stored procdure and is running perfectly thro' backend.
And if i click the button again, another ADODB error comes
" The Call to member Connection String failed.
Operartion is not allowed when the object is open ".
This error message comes every time when i click the button there after.
The first error comes only in the first click .
How can i solve this??
Thanks
shibily0 -
The second one is easy. After the error, the connection was not closed. After that, you try to open the connection again, which results into the error.
The first one is something else. Your code looks fine, so I must guess some things ....
- Is the SP in the database you're connecting to
- try to remove the space after the Database-keyword in the connectionstring
- Are you working case sensitive collation and is your SP name in the right case(s)
- ... ?0 -
Waldo wrote:The second one is easy. After the error, the connection was not closed. After that, you try to open the connection again, which results into the error.
The first one is something else. Your code looks fine, so I must guess some things ....
- Is the SP in the database you're connecting to
- try to remove the space after the Database-keyword in the connectionstring
- Are you working case sensitive collation and is your SP name in the right case(s)
- ... ?
Hi,
I checked everything ..
There is no space in the connection string. i pasted the same SP name . Still i am facing the same issue...
Thanks
Shibily0 -
Waldo wrote:I just copy/pasted fragments from my blog ... and it works
.
It is hard to help you on this when I do not have the exact code .. . May be you can share it? SP and C/AL?
Hi,
Finally , I succesfully called the Stored Procedure from navision. I used the same fragments from Waldo 's blog. Dont know why it didnt work earlier. Anyways thanks all for your support.
Shibily0
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