Crystal Report using in DotNet

Hi all,

I am going to explain how to create a report by using Crystal Report in DotNet here.

Generating Report:
----------------------


To create a report using crystal report, just follow the steps mentioned below which is very useful to using crystal repot.

In Visual Studio 2005, create new project with a name as your wish. Add a new item to the project by right clicking on the project name in solution explorer. Select the crystal report template with a name as your wish.

Now you are in Crystal Report Gallery dialog. Now you should choose the “Using the Report Wizard” and “Standard” options and click OK.

The Standard Report Creation Wizard dialog will appear. Now you should choose the data source to connect SQL Server 2005. For that just expand the Create New Connection data source and expand the OLEDB(ADO) item. Then select an OLEDB provider “SQL Native Client” for SQL Server 2005 databases.

Now we need to provide the connection information for the database. Type the server name and check the Integrity Security checkbox. Then click the dropdown list next to the database item and select the database. Click the next to continue, in next dialog finish to configuring the data source.

Now you need to choose the tables to use for the report. Expand your database and select the tables by using > button.

Click the next to continue. Here you need to confirm the relationships between the various tables you have selected. Then click the next to continue.

Now you should choose the fields to use for the report by using > button. Then click next, in the next dialog you should choose the field to group the report.

Clicks next to continue there will three dialogs seemed. Just give next and next, in final dialog you can select report style finally click finish then your report will be ready.
Previewing Report:
---------------------

After creating the report, you can preview that by clicking the Main Report Preview button which is in the bottom of report.

Viewing your Report in Windows Form:
--------------------------------------------


If you want to see the report in windows form, you will need to use the CrystalReportViewer control.

First you will need to add a new windows form to the project. And add the CrystalReportViewer control in to your form. Now add a button control in to form and named it as “ViewReport”.

Then write code as below in the button clicked event.

CrystalReport1 report = new CrystalReport1();
{
Form2.CrystalReportViewer1.ReportSource = report;
Form2.ShowDialog();
}


...S.VinothkumaR.

Diamond inheritance / Ambiguities in inheritance

Hi friends,
Here I am explained the Diamond Inheritance and Ambiguities in inheritance. Just watch out the below image and with my explonation.


The above figure illustrates the diamond inheritance. The class IOS is the base class for both IStream and OStream classes. Each of those classes formed with single inheritance. The class IOStream inherits from both IStream and OStream classes. This class object will provide the functionality of both IOStream and OStream classes. In multiple inheritance hierarchies, the situation described in above figure is referred to as Diamond Inheritance.

There would be seemed a problem in IOStream class. Because the class IOStream contain two copies of the members of class IOS. One inherited via the class IStream and another one inherited via the class OStream. Such a situation would be ambiguous and would result in a compilation error. Because the compiler wouldn’t know which version of members from class IOS to use.

In this situation, the virtual base class solves the problem of inheriting duplicate copies of an indirect base class.

...S.VinothkumaR.

Converting xml to string in C#

Hi friends,
Here is the simple code for converting xml to string.
string strXML = "";
StringReader reader = new StringReader("C:\\test.xml");
XmlDocument doc = new XmlDocument();
doc.Load(reader);
if (doc != null)
{
StringWriter writer = new StringWriter();
doc.Save(writer);
strXML = writer.ToString();
}
doc = null;


...S.VinothkumaR.
Hi all,
Here I have listed the JavascriptCode, Numerical code and Hex code for some symbols. Find out from the following images.












...S.VinothkumaR.

Difference between Stack and Heap

Stack:
- Variables of value type are allocated in stack.
- Memory allocation of stack is speader than heap.
- If the object is small we should use value type (stack).
Heap:
- Variables of reference type are allocated in heap.
- Memory allocation is slow.
- If the object is big one, using reference type is fine (heap).

...S.VinothkumaR.