Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing to the default printer?

Status
Not open for further replies.

gbaughma

IS-IT--Management
Staff member
Joined
Nov 21, 2003
Messages
4,773
Location
US
I have a website that will be taking orders through a web store.

Is there a way to have SQL print to a printer from a stored procedure, so that sales orders can print out automagically when the sale is complete?


Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
I agree with Markros.

Your stored procedure could mark a row in a table as "order complete but not printed".

Then, write an app that checks this table once every 5 minutes. If it find an order that has not been printed, then print it and mark it as having been printed already.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Mmm... that's pretty much the way we're doing it now... I have a VB.NET application that looks for just that field (Printed Y/N)... I was hoping that rather than keeping that program running all of the time, that I could do it all from a stored procedure; I would have the stored procedure format the printed page, print it, then continue on to update our accounting software; then it would be "On demand" instead of a continual poll.



Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
The problem with using a stored procedure to print is that the printing would need to finish (or at least the printer queuing part) before the stored procedure finished.

If you have SQL Standard (not express), you could schedule a job at a very short interval to do the checking for you. Then, you could maybe use sqlcmd to run an executable (that you create) to do the printing.

Please be aware that you need to be VERY careful about executing an external application because if it stops for any reason, your call in SQL will never finish.

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
I'm running SQL Server 2008 standard.

Just my 2¢

"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."

--Greg
 
I tried twice to reply to this thread, but it wouldn't let me. Maybe email would be more appropriate. [wink] [wink]

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top