Monday, March 26, 2012

periodic check for records to print

Every 10 seconds I need to search a SQL table for orders to print. The order
s
are created through WebForms on ASP.NET clients. The orders should not print
until
10 minutes before they are due.
The network printer will be available from the server running IIS and SQL
Server 2000.
If this were a Windows Forms application, then I would create a system timer
in Form1.Load(). How is this done in an ASP.NET application?Just a note of caution. Writing windows services can be tricky, so just be
prepared to possibly have to spend a little time with it. Debugging is a
little more complex and awkward.
Terry Burns
http://TrainingOn.net
"Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
> You should separate the printing function from the rest of your ASP.NET
> forms
> application. The purpose of a web application is to deliver data over
> HTTP
> protocol using an HTTP client (browser). The application you described is
> most suitable for a service, i.e., create a windows service, that runs on
> your web (or any other) server connected to the desired printer.
> For detailed documentation on how to create a Windows Service:
> http://msdn.microsoft.com/library/d...r />
ations.asp
>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Tony" wrote:
>
Thanks for the advice to separate the printing function. I am a little
familiar with the service programming model. The last service I wrote was fo
r
NT 3.51 many many moons ago. I remember some limitations to accessing the GD
I
and databases.
My printing function must connect and access data on SQL Server and then
print. I read through the information at the url that Phillip provided and
all of the other pages in that section. I stll have a couple questions
remaining:
Is there tech support that documents the .NET namespaces that can be used
inside a windows service?
Can I use the ADO.NET functions inside a windows service?
Can I print a crystal report from a windows service,
or can I use the GDI+ and System.Drawing.Printing.PrintDocument.Print()
method from a windows service?
"Terry Burns" wrote:

> Just a note of caution. Writing windows services can be tricky, so just be
> prepared to possibly have to spend a little time with it. Debugging is a
> little more complex and awkward.
> --
> Terry Burns
> http://TrainingOn.net
> "Phillip Williams" <WEBSWAPP@.newsgroups.nospam> wrote in message
> news:B765641F-9B69-47A5-B8AB-1C1A1662EE46@.microsoft.com...
>
>
Hi Tony,
As long as the PC that will run the server has the .net framework installed
then all of the functions that you listed will be available to the Windows
Service, as it would to any desktop application. The main difference betwee
n
the Windows Service and the desktop application is that in the former you
would not display a GUI that requires user input.
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Tony" wrote:
> Thanks for the advice to separate the printing function. I am a little
> familiar with the service programming model. The last service I wrote was
for
> NT 3.51 many many moons ago. I remember some limitations to accessing the
GDI
> and databases.
> My printing function must connect and access data on SQL Server and then
> print. I read through the information at the url that Phillip provided and
> all of the other pages in that section. I stll have a couple questions
> remaining:
> Is there tech support that documents the .NET namespaces that can be used
> inside a windows service?
> Can I use the ADO.NET functions inside a windows service?
> Can I print a crystal report from a windows service,
> or can I use the GDI+ and System.Drawing.Printing.PrintDocument.Print()
> method from a windows service?
> "Terry Burns" wrote:
>
sorry for couple w delay as I moved from design to implementation ...
Now I have created my windows service
The printdocument.print function is NOT firing the printPage event.
I am using several eventlog.WriteEntry() statements to know how my program
is working and which functions are called. The structure of the program is
similar to the example in the PrintDocument Class documentation.
There is no microsoft.public.dotnet.service group, so I am not sure if this
dotnet.framework.aspnet group is the proper place to continue this discussio
n.
I will post the question again at microsoft.public.dotnet.framework and
include my source code.
btw, the data entry web pages are working very nicely...
"Phillip Williams" wrote:
> Hi Tony,
> As long as the PC that will run the server has the .net framework installe
d
> then all of the functions that you listed will be available to the Windows
> Service, as it would to any desktop application. The main difference betw
een
> the Windows Service and the desktop application is that in the former you
> would not display a GUI that requires user input.
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
> "Tony" wrote:
>
Found a caution from Microsoft not to do this.
"Classes within the System.Drawing.Printing namespace are not supported for
use within a Windows service or ASP.NET application or service. Attempting t
o
use these classes from within one of these application types may produce
unexpected problems, such as diminished service performance and run-time
exceptions.
"
found it at
http://windowssdk.msdn.microsoft.co...ng_printing.asp
"Tony" wrote:
> sorry for couple w delay as I moved from design to implementation ...
> Now I have created my windows service
> The printdocument.print function is NOT firing the printPage event.
> I am using several eventlog.WriteEntry() statements to know how my program
> is working and which functions are called. The structure of the program is
> similar to the example in the PrintDocument Class documentation.
> There is no microsoft.public.dotnet.service group, so I am not sure if thi
s
> dotnet.framework.aspnet group is the proper place to continue this discuss
ion.
> I will post the question again at microsoft.public.dotnet.framework and
> include my source code.
> btw, the data entry web pages are working very nicely...
> "Phillip Williams" wrote:
>

0 comments:

Post a Comment