-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How to Design Crystal Reports Using nHibernate
PostPosted: Mon Feb 06, 2006 2:46 am 
Newbie

Joined: Mon Feb 06, 2006 1:40 am
Posts: 1
Location: Trivandram,Kerala
You can create crystal reports using nHibernate. follow the steps
1. Create a dataset (.xsd) file and create an element with a name.
2. Design the report using the data set. ( follow PUSH method of crystal reports)
3. Now you get the data using HQL or Directly from nhibernate object and pass those data to dataset. IT will be displayed in the report. Since the datset you had created is not linked with database directly we can say its a database Independent report.
Eg.
I had created a dataset and an element in the dataset named rptstock. and in my code behind i had created a method for creating a dataset. see the code


public DataSet GetDataSource(string HSql)
{
DataSet objDataSet=new DataSet();
DataTable objTable=new DataTable("rptStock");
IList objlist=GetReportData(HSql);

objTable.Columns.Add("cName");
objTable.Columns.Add("cDescription");
objTable.Columns.Add("nQty");
objTable.Columns.Add("dDate");
objTable.Columns.Add("cType");

DataRow myRow;
foreach (object[] arrobject in objlist)
{
int i=0;
myRow=objTable.NewRow();
myRow[0]=arrobject [0]
myRow[1]=arrobject [1]
myRow[2]=arrobject [2]
myRow[3]=arrobject [3]
myRow[4]=arrobject [4]

objTable.Rows.Add(myRow);
}
objDataSet.Tables.Add(objTable);
return objDataSet;
}

--Getting Data from nHibernate objects
private IList GetReportData(string sSQL)
{
cfg=new Configuration();
cfg.AddAssembly("AssemblyName");
factory = cfg.BuildSessionFactory();
ISession session=factory.OpenSession();
string strHBQ=sSQL;
IList objList= session.CreateQuery(strHBQ).List();
session.Close();
return objList;
}

Now u can set datasource of the report and view report


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 3:09 am 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
you may have better luck posting this to the nHibernate forum.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.