Link to home
Start Free TrialLog in
Avatar of TartanTaurus
TartanTaurusFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to call a stored procedure from a function

Hi,

I'd like to know how / correct syntax I should be using to call a stored procedure in SQL Server from a script function in JavaScript.

The environment I'm working in is Sage CRM however the answer to this question does not appear to need to be specific to any particular software.

Thanks
Avatar of elimesika
elimesika
Flag of Israel image

Avatar of TartanTaurus

ASKER

Thanks for that,

I have my connection as follows, but when I try to call it, I get an error saying it cannot find stored proc by that name. Any suggestions?

Thanks


function UpdateRecord()
 
{
var connection = new ActiveXObject("ADODB.Connection");
connection.Open("Data Source=localhost\\TabletProject,1433;Provider=SQLOLEDB;User Id=sa;Password=xxxxx;Persist Security Info=True;Initial Catalogue=G41;");
 
var r = connection.Execute("exec customrefproc");
 
oppo_customref = r; 
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of elimesika
elimesika
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial