ReportViewer print problem - Security Patch KB925902

August 12, 2008

(0) Comments

Few weeks back , I have this reportviewer printing problem during our UAT. When user click the print button in reportviewer the machine died and reboot :( , and its only happen in few machine. In others machine reportviewer working fine.

Further finding shows only the machines that have installed the Security Patch KB925902 facing this problem.

The problem

The user machine crash and reboot when users click print button in reportviewer.

Cause

The problem exist after the installation of Security Patch KB925902 and microsoft site reported following models of printers effected

• Ricoh LAN Fax Driver
• Gestetner P7026n PCL
• Ricoh Laser AP2600N PCL
• HP LaserJet 9050
• HP LaserJet 4200
• HP 4050 PCL6
• HP LaserJet 4345 PCL 6
• Canon Pixma MP170

The site also stated

This problem occurs when a printer driver makes a call that has invalid parameters to the Win32K.sys component. This problem affects the following printer drivers:

Solution

I guess you already know , yes apply another hotfix , KB 935843

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

July 23, 2008

(4) Comments

I’m been facing this timeout problem in my report query especially for rdlc report where the application need to provide the datasource for the report. The error prompt more frequently when the number of records increased in table, so most of time you won’t have this timeout error during your development or early stage of production. But when when production data increasing you will facing timeout error.

There is 2 thing i can suggest here to avoid this problem. First keep your query or view simple and fast enough. What i mean here is make sure you use the correct joins in query if you ever need one and only put the fields that you need in query. Number of column if too many in your query or view will also make the execution time longer. But sometimes we can’t avoid creating a query or view that take so much memory and execution time so when you arrive on this situation its a must to set the timeout property to longer time.

There are two main Timeout property in ADO.NET.

1. Connection Timeout for Connection
2. Timeout for Data Access( Command Object or DataAdapter)

How to set Connection Timeout property for sql connnection object ?

You can’t set timeout property in connection object because its a read only property


// you cannot do this
SqlConnection conn = new SqlConnection("server=Server;uid=sa;pwd=123456;database=myDB;Connection");
conn.ConnectionTimeout = 100;

The correct way to do this is set the timeout value in connection string like the example below.


// the correct way to set connection timeout
SqlConnection conn = new SqlConnection("server=Server;uid=sa;pwd=123456;database=myDB;Connection Timeout=90");

Next , How to set timeout property in DataAdapter or Command Object ?

Its pretty simple as shown below.


SqlDataAdapter sqlAdapter = new SqlDataAdapter();
sqlAdapter.SelectCommand = new SqlCommand(sqlQuery, conn);
sqlAdapter.SelectCommand.CommandTimeout = 0;

Setting the timeout value to 0 will makes adapter or command to wait for indefinite time before terminating the attempt to execute a command and generating an error.

The default timeout value for connection object is 15 seconds.
The default timeout value for DataAdapter or Command Object is 30 seconds

If you have better ways to overcome this timeout problem please leave your comments. It will be very helpful :)