Options

Using consoles apps from SQL to NAV

MTCMTC Member Posts: 159
edited 2007-11-15 in SQL General
I have a slight problem that is totally doing my head in and makes no sense to me, and hopefully one of you might know at least why it is doing this.

I have written a small application in C# that is invoked from SQL Server 2000 using EXEC master..xp_cmdshell in a trigger.

The console application should send an MSMQ to a queue that a NAS is listening to, and that's it. The small C# application works perfectly when run from the command line, and NAS picks up the messages perfectly as well. However, when run from the SQL trigger, it does absolutely nothing apart from the lines of code that output text to the console. It is as if it ignores all code lines that are not writing text to the console. I even commented out the MSMQ functionality and placed some code there that creates a file and writes to that. However, it does exactly the same thing. Works perfectly when run from the comand line, but does nothing if invoked from SQL apart from print to the console, which is the last line in the program. It doesnt even create the output file.

Has this got something to do with permissions? Does anyone have a clue, as it would be much appreciated.

Sorry if this is in the wrong forum.

Comments

  • Options
    krikikriki Member, Moderator Posts: 9,090
    I suppose it is run by the SQL Server Agent.
    In this case : has your SQL Server Agent-service enough Windows permissions to do it? It can be necessary to change the Windows-user of the SQL Server Agent.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    krikikriki Member, Moderator Posts: 9,090
    [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!


  • Options
    MTCMTC Member Posts: 159
    I have wrote the same in Visual Basic .NET and it works no problem. It must be something the C# compiler is doing.
  • Options
    kinekine Member Posts: 12,562
    Or it is about permissions for the application. Check the permissions settings of your project. May be that VB.NET is not as strict as C#.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.