all groups > sql server programming > february 2004 >
You're in the

sql server programming

group:

Stored Procedures & Reports



Re: Stored Procedures & Reports oj
2/10/2004 6:09:48 PM
sql server programming: Did you install all the necessary component/library for Crystal on the
sqlserver box. Does the sqlserver service startup/sqlcmdexec(proxy) account
has proper access. Is there a printer setup on the server. Does the account
have access to the printer.

Remember that xp_cmdshell runs directly on the sqlserver box and it does not
allow any user interaction with the external app.

--
-oj
http://www.rac4sql.net


[quoted text, click to view]

Stored Procedures & Reports JPG
2/10/2004 11:30:13 PM
Helo,

My goal is to print a Crystal Report from a Stored Procedure. I've written a
VB.NET console aplication wich succesfully prints a report on the printer,
however when this aplication gets called from the Stored Procedure (using
xp_cmdshell) the application runs succesfully but it won't print.

My real need here is to get a printed page wich has a nice format. Kind like
a bill with the company's logo, a column for the product and another column
for the price of each item, and at the bottom the total price. I guess this
kinf of job should be easilly done with Crystal Reports... but as I've
stated I can't get it to print through the Stored Procedure (although
printing ok if it gets runned through the command shell).

Could some one give me a hint as how it could be done? Or better of, how I
could solve the problem with the Crystal Report?

Thank you for showing interest on this mesage.

Best wishes.

Re: Stored Procedures & Reports JPG
2/11/2004 9:55:47 AM
Helo,

Thankyou for your reply.

I've been developing the application directly on the same machine where SQL
Server is installed... The application runs OK when I run it from a command
shell on the server machine. Therefore I guess the components, Libraries,
executable, and printer are OK. The problem comes when I execute it from SQL
Server inside a stored procedure. The application runs ok, and the output
from the program is captured by SQL Server, but the printer won't attempt to
print the document.

SQL Server is setup to start as service. Therefore I guess the SYSTEM
account should be used. The printer has permision to grant all. My guess is
this configuration should work ok (Although it might be a wrong guess as it
doesn't work at the moment). Must I start the Server as a User ccount for it
to work?

Any ideas?

Best Wishes




"oj" <nospam_ojngo@home.com> escribió en el mensaje
news:uF2XhQE8DHA.2752@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Re: Stored Procedures & Reports oj
2/11/2004 4:18:48 PM
Although you can startup sqlserver with a system account, it does not have a
profile with a attached printer.

To ensure you can *print* from sqlserver, log into the machine with the
account you use to startup sqlserver service. Add a default printer. Now,
when you invoke xp_cmdshell with an admin account, you should be able to
print to the default printer.

what do you get when you do something like this...

exec master..xp_cmdshell N'print c:\autoexec.bat'


--
-oj
http://www.rac4sql.net


[quoted text, click to view]

AddThis Social Bookmark Button