Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Cant open external process from CLR

Author  Topic 

pistolpete100
Starting Member

2 Posts

Posted - 2008-01-31 : 07:48:15
Hi,



I am trying to print a PDF via a stored procedure in SQL Server 2005 using c#



I first wrote a stand alone version which works perfectly however after porting it into SQL server the program no longer works



Went back to basics and just tried to open notepad from standalone and from within CLR - again works until I put code into SQL Server DB



Trouble is that it seems to run ok - prints lines to console etc... but the notepad application doesnt start up - there are no errors so really struggling to find out why this might be



Anyone have any ideas, had similar issues?? - Only thing I can think of is a permissions/credentials issue of some kind but again dont have any errors???



I have created the dll file and assembly successfully (using unsafe mode)



Thanks in advance



Code sample below:

.

.

.

executable = "notepad.exe";

ProcessStartInfo starter = new ProcessStartInfo(executable, null);

starter.CreateNoWindow = true;

starter.RedirectStandardOutput = true;

starter.UseShellExecute = false;

Process process = new Process();

process.StartInfo = starter;


process.Start();

.

.

.

eyechart
Master Smack Fu Yak Hacker

3575 Posts

Posted - 2008-01-31 : 12:41:56
i don't have an answer for you, but I do want to comment on this. This sounds like a ridiculous design. why are you trying to print from your database? this should be a client side function only.



-ec
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2008-01-31 : 17:11:27
Your SQL Server is running under a different account to the one you are looking at. Your desktop session is your user, the SQL Server is running as LocalSystem (or whatever) and has no desktop session. So how are you going to see it's notepad instance ? Windows is a multi user OS.

Still, I'm with eyechart, this is a horrible design. Run this as an external process.

Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

pistolpete100
Starting Member

2 Posts

Posted - 2008-02-01 : 05:14:22
Hi,

What we want to do is auto print out a PDF which is auto-generated using the report server via a DB stored Procedure - I have been able to do this on my dev environment but not on my test and I cant see what the difference is - the code is the same, only difference is the different instances of SQL Server 2005 -

On the user accounts issue, I have checked the checkbox in the properties tabs in SQL Server service that allow interaction with the desktop, i thought that would have solved the problem but it doesn't cant see any other differences in permissions that I would need to apply???
Go to Top of Page
   

- Advertisement -