Click here to Skip to main content
12,399,975 members (48,558 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-server-2005 C#2.0 C# , +
I am devolving a project for a General Store.
There I need to print the bill as and when it is saved to my database.
I am using Crystal Report. But I didn't make it visible. It is printing directly.

My Code is
{
after saving.....
SqlDataAdapter da3 = new SqlDataAdapter("select * from SalesDetails where BillNo='" + textBox1.Text + "'", con);
            DataSet ds3 = new DataSet();
            da3.Fill(ds3, "SalesDetails");
            rptSalesbill abc = new rptSalesbill();
            abc.SetDataSource(ds3.Tables[0]);
            System.Drawing.Printing.PrintDocument printDoc = new System.Drawing.Printing.PrintDocument();
            int i;
            int rawKind = 0;
            for (i = 0; i < printDoc.PrinterSettings.PaperSizes.Count; i++)
            {
                if (printDoc.PrinterSettings.PaperSizes[i].PaperName == "4x1")
                {
                    rawKind = (int)GetField(printDoc.PrinterSettings.PaperSizes[i], "kind");
                }
            }
            abc.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;
            abc.PrintToPrinter(1, true, 0, 0);
}
 private object GetField(Object obj, String fieldName)
        {
            System.Reflection.FieldInfo fi = obj.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            return fi.GetValue(obj);
        }

But the bill is printing slowly it is taking around 6 secs to print bill.
How can I decrease the time to print.
6 secs is too much for the general store because they have lots of customer in a queue.
Not for the first time! all the time. First time it is taking around 12 secs.
Please please help me I am in a big problem.
Posted 18-Aug-12 7:51am
Updated 18-Aug-12 7:54am
v2
Comments
Sergey Alexandrovich Kryukov 18-Aug-12 14:06pm
   
Yes, something wrong with printing, maybe even hardware. You might need to simplify down, say, use some primitive POS printer. However, I see a number of decent POS apparently based on Windows and very rich applications, working very fast despite of printing in graphics, line going fast...
--SA
Kenneth Haugland 18-Aug-12 18:35pm
   
From OP:
Thanks for your quick reply. but I am not the owner of the general store. They are using TVS justbill printer. But that doesn't matter, to send the instruction to the printer it is taking 6 secs, afterwards I don't have to taking care of. I want to decrease that 6 secs.
Sourav972 19-Aug-12 10:47am
   
What Kenneth?
Sourav972 18-Aug-12 14:19pm
   
Thanks for your quick reply.
but
I am not the owner of the general store.
They are using TVS justbill printer.
But that doesn't matter, to send the instruction to the printer it is taking 6 secs, afterwards I don't have to taking care of.
I want to decrease that 6 secs.
Sergey Alexandrovich Kryukov 18-Aug-12 22:24pm
   
Yes, I see... do you have to use Report based approach at all. You could format and print data directly, where all the code in your hands. Maybe reports are not speed-savvy in principle, one of its main goal is to reduce the labor in developers; and many of such developers are not so qualified; so doing it by yourself could be a solution, I don't know exactly. Did you think about it? Everything should be prototypes and evaluated, speed too...
--SA
Sourav972 19-Aug-12 10:36am
   
I change my a little bit.
Now its taking 3-4 secs but they are still not satisfied.
Can advise me any other way to print the report which is faster than Crystal Report.
ShaikhM 21-Aug-12 23:04pm
   
Have your tried Reporting Services. Its easy to build a report on that. You can compare the times on both crystal reports and SSRS and then decide.
Sourav972 22-Aug-12 3:17am
   
No I don't know about this SSRS.
can you please explain a little bit or suggest any link.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

SSRS reports are much faster, when compared to Crystal reports.
I think you should go for it.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160721.1 | Last Updated 18 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100