this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Wednesday, June 6, 2012

Print button is not working in Crystal report viewer


Crystal report is very crucial part of LOB application reporting. Most of enterprise uses Crystal Report for the reporting purpose. In case of windows platform, it has good integration with .net framework and .net provides crystal report viewer for rendering Crystal report.

From the early, VS 2005 has inbuilt integration with Crystal report version 10. We don’t need to install other component for accessing Crystal Report Viewer. It was straight forward process, for running that application on client machine we all need is installing Crystal Report runtime.

It was going good and we didn’t come across any issues till date. Some older applications were built on VS 2005 and it was running in most of windows operating system with runtime and necessary component installed. Problem arose with 64bit version, when we try to install application built on VS 2005 and using crystal report on Win 7 64bit or other later version of 64bit. In that case, we don’t able to take advantage of printing facility of Crystal report viewer.

After investigating, we found that there was problem with crystal report version10. If we upgrade our crystal report version to later on, it would work and it did.

We choose path of upgrading our solution to VS 2010, and what we found that we didn’t see any Crystal Report viewer in toolbox. It requires installed explicitly, Microsoft stops to ship that along with VS 2010.

I hope below link is worth to keep with us while upgrading to vs2010 for Crystal Report .


Hope this post will be helpful!

Tuesday, June 5, 2012

Change default time out of strongly typed dataset table adapter command.


By default when every any command executed by table adapter, its time out is 30 second. Due to heavy load of data and traffic over the network, we require increasing this default time out.
It’s very straight forward when we use code for it. In case of strongly data set it’s a bit tricky.
Firstly, you will require extending your dataset existing name space and its table adapter. In data table adapter class, you can add one method for changing this time out.
//Extend existing data table adapter class created by strongly typed dataset.
Namespace MyTableAdapters
Partial Public Class MyTableAdapter

Public Sub SetCustomCommandTimeout()
Utility.SetCommandTimeout(CommandCollection)
End Sub

End Class
End Namespace
//Set Custom Timeout to underlying command.
Public Shared Sub SetCommandTimeout(ByVal commands As System.Data.SqlClient.SqlCommand(), Optional ByVal timeout As Integer = -1)

If (commands IsNot Nothing) Then

If (timeout < 0) Then timeout = GetConfigTimeout()

For Each cmd As System.Data.SqlClient.SqlCommand In commands
cmd.CommandTimeout = timeout
Next

End If

End Sub

//Get Custom time out from web.config.

Private Shared Function GetConfigTimeout() As Integer

Dim timeOut As Integer
If Not System.Configuration.ConfigurationManager.AppSettings("CommandExecutionTimeOut") Is Nothing Then
timeOut = CType(System.Configuration.ConfigurationManager.AppSettings("CommandExecutionTimeOut"), Integer)
Else
timeOut = 0
End If

Return timeOut

End Function

Hope this would be very helpful !!