Execute a Stored Procedure??

jonkarjonkar Member Posts: 13
We are currently running Navision 3.7 on SQL Server 2000.
I would like to know if it is possible to execute a stored procedure from a Trigger in C/Side?

Thanks,

J.

Comments

  • ara3nara3n Member Posts: 9,257
    well you can trigger your stored procedure on insert of a record. From navision all you do is insert a record and it'll trigger your stored procedure.
    The other option is use COM object to connect to sql and execute your stored procedure. There are a couple of threads on this subject. Searching would help.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • WaldoWaldo Member Posts: 3,412
    Take the Application Designer's Guide. It explains how to execute SP's.

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • jonkarjonkar Member Posts: 13
    I think you are telling me how to run Navision Code created with C/Side???
    What I want to run a Stored Procedure within "SQL SERVER 2000" not in Navision.
    When running a SQL SERVER stored procedure it is executed on the SERVER, when you run a trigger in Navision it is executed on the Client....

    So I need to be able to tell SQL Server, from C/SIDE to execute a Stored Procedure that I created in "SQL Server Enterprise Manager".

    Thanks,


    J.
  • wonmowonmo Member Posts: 139
    Using an ADO Connection object open it first with the relevant connection string and then pass the name of the stored procedure and execute:

    ADO_Connection.Execute({sp name});

    You can pass parameters but if you want return values then you probably will have to use the ADO command object.

    Hope this helps.
  • kongsterkongster Member Posts: 4
    How do I use ADO? I need detailed explanation of how to execute stored procedure from Navision. I can access my stored procedures through SQL Query Analyzer but I need to execute them from Navision.

    What do I need to do?
  • itspeteritspeter Member Posts: 105
    Name	DataType	Subtype	Length
    conn	Automation	'Microsoft ActiveX Data Objects 2.8 Library'.Connection
    
    CREATE(conn);
    conn.Open('Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=[Servername];Data Source=[Databasename]');
    conn.Execute('EXEC StoreProcedureName');
    conn.Close;
    CLEAR(conn);
    

    Hope it helps.
    Regards,
    Peter Ng
Sign In or Register to comment.