Archive for April, 2011

Customized Thousand Separator in Crystal Report

Crystal Report Provides an easy to use default thousand separator for numeric Fields. You can use it by checking Thousand Separator from Field Properties.

However, when you want your own kind of thousand separators you have to go through more complications. You will have to use Formula Fields of Crystal Report. Continue reading

Advertisements

Preventive measures with Delete or Update Command in SQL Server 2005

Though it’s not wise trying to run Delete or Update command in any live database, sometimes situations compel to do so. Truly speaking, this is the most dangerous task. You may end up deleting or updating all of your data. For example


DELETE FROM t_BillMaster
WHERE BillMasterID =1;

Continue reading

How to set Crystal Report Header in Visual Studio 2008

I wasted almost a day searching on google to resolve this issue. If you want to set some values or title of report dynamically from code behind, you can use this following code snippet.

string amount = amountTextBox.Text;
string titleString = "        Total Sanctions above  ";

List investmentList = new List();
investmentList = new InvestmentManager().CollectAmountWiseInvestment(amount);

expirySanctionCrystalReport reportDocumentObject = new expirySanctionCrystalReport();

//Set Crystal Report Header 
CrystalDecisions.CrystalReports.Engine.TextObject amountText = (CrystalDecisions.CrystalReports.Engine.TextObject)reportDocumentObject.ReportDefinition.ReportObjects["dateText"];
amountText.Text = amount;

CrystalDecisions.CrystalReports.Engine.TextObject titleText = (CrystalDecisions.CrystalReports.Engine.TextObject)reportDocumentObject.ReportDefinition.ReportObjects["TextTitle"];
titleText.Text = titleString;

reportDocumentObject.SetDataSource(investmentList);
amountWiseCrystalReportViewer.ReportSource = reportDocumentObject;
amountWiseCrystalReportViewer.RefreshReport();
amountWiseCrystalReportViewer.Visible = true;

Continue reading