Crystal Report With DataSet and DataTable Using C# - CodeProject
Crystal Report With DataSet and DataTable Using C# - CodeProject
Cr stal Report
Home
Articles
C#
Quick Answers
Reporting
Discussions
Learning Zones
Features
Help!
The Lounge
C POL 28 Aug 2008 81,951 1,917 58 times
Sea ch
Languages
See Also
More like this More by this author
12
Sponsored Links
MX-Frame Business Application Framework www.mxframe.net Search for ASP.NET Add search engine functionality to your ASP.NET web site. Features... keyoti.com
Introduction
In my previous article, I described how to create Crystal Report with Oracle Views. In this article, I am going to demonstrate how to create a Crystal Report with ADO.NET D aa T a b l e . You will find this article very interesting, simple and easy to understand. This article needs basic knowledge of .NET. Note: Please vote for this article.
Background
No background knowledge is needed for this article. This article is very simple and just requires very basic knowledge of .NET. But I recommend reading my previous article as well, though it has no direct relation with this article.
See Also...
C reating animations with Dundas C hart for ASP.NET Smarter Data Labels with Dundas C hart SmartLabels Understanding C hart Areas with Dundas C hart for .NET Making Sense of Geographic Data with Dundas Map and AJAX DestroyWindow in VBScript SmartLink C reate data-driven applications
c r e ae a b l e b l _ p r o j e c ( P R O J E C T _ I DN U M B E R ( 4 ) , P R O J E C T _ N A M E V A R C H A R 2 ( 1 5 0 ) , G R O U P _ C O D E N U M B E R ( 2 ) ) c r e ae a b l e b l _ p r o j e c_ g r op
.codeproject.com/KB/cs/Cr stalReportNDataTable.asp
1/8
05/12/11
( G R O U P _ C O D E N U M B E R ( 2 ) , G R O U P _ N A M E V A R C H A R 2 ( 1 0 0 ) ) ; i ne i ne i ne i ne i no b l _ po j e c i no b l _ po j e c
Cr stal Report
a le( 1 , ' C
a l R e p o W ih Oa c l e ' , 1 ) ;
Digital Signatures and PDF Documents WMP Power Hour APP Merge Landscape and Portrait PDFs using ASP.NET Using Barcodes in Documents Best Practices
First of all, create a project in Microsoft Visual Studio 2005 and name it C
a l R e p o W ih Oa c l e .
How to Retrieve EMC C entera C luster/Pool C apabilities Using multiple keyboards with different layouts on the same machine "Hey! Is That My C ar? How to Sharpen a QuickBird Satellite Image Using DotImage" Integrate your SharePoint environment into the open standards-based WebSphere Portal platform using the Visual Studio IDE
Then create a form as f m M a i n and add a Crystal report viewer control to this form. Add a Reference to S e m . D aa . Oa c l e C l i e n.
Now add a D aa T a b l e to m D aa S e:
Now add columns to your D aa T a b l e as given below in the image. Your column name and d aa p e should be the same as that in your database.
.codeproject.com/KB/cs/Cr stalReportNDataTable.asp
2/8
05/12/11
Cr stal Report
Change he d a t a tp e of he D a t a T a b l e col mn a
ho n belo :
No
a e hi D a t a T a b l ea m_ d t .
No
e ha e c ea ed o
D a t a S e t and D a t a T a b l e . The ne
ep i
o c ea e a C rs t a l R e p o r t .
.codeproject.com/KB/cs/Cr stalReportNDataTable.asp
3/8
05/12/11
Cr stal Report
.codeproject.com/KB/cs/Cr stalReportNDataTable.asp
4/8
05/12/11
Cr stal Report
ou want.
.codeproject.com/KB/cs/Cr stalReportNDataTable.asp
5/8
05/12/11
Cr stal Report
S ep 3: Binding O r Repor
o o r Da aSo rce
u s i n gS y s t e m ; u s i n gS y s t e m . C o l l e c t i o n s . G e n e r i c ; u s i n gS y s t e m . C o m p o n e n t M o d e l ; u s i n gS y s t e m . D a t a ; u s i n gS y s t e m . D r a w i n g ; u s i n gS y s t e m . T e x t ; u s i n gS y s t e m . W i n d o w s . F o r m s ; u s i n gS y s t e m . D a t a . O r a c l e C l i e n t ; u s i n gS y s t e m . I O ; n a m e s p a c eC r y s t a l R e p o r t W i t h O r a c l e { p u b l i cp a r t i a lc l a s sf r m M a i n:F o r m { p u b l i cf r m M a i n ( ) { I n i t i a l i z e C o m p o n e n t ( ) ;
p r i v a t ev o i df r m M a i n _ L o a d ( o b j e c ts e n d e r ,E v e n t A r g se ) { m y _ r p to b j R p t ; / /C r e a t i n go b j e c to fo u rr e p o r t . o b j R p t=n e wm y _ r p t ( ) ; S t r i n gC o n n S t r=" S E R V E R = m y d b ; U S E RI D = u s e r 1 ; P W D = u s e r 1 " ; O r a c l e C o n n e c t i o nm y C o n n e c t i o n=n e wO r a c l e C o n n e c t i o n ( C o n n S t r ) ; S t r i n gQ u e r y 1=" s e l e c ta . P R O J E C T _ I D , a . P R O J E C T _ N A M E , b . G R O U P _ N A M Ef r o m t b l _ p r o j e c ta , t b l _ p r o j e c t _ g r o u pbw h e r ea . g r o u p _ c o d e =b . g r o u p _ c o d e " ; O r a c l e D a t a A d a p t e ra d a p t e r=n e wO r a c l e D a t a A d a p t e r ( Q u e r y 1 ,C o n n S t r ) ; D a t a S e tD s=n e wD a t a S e t ( ) ; / /h e r em_ d ti st h en a m eo ft h eD a t a T a b l ew h i c hw e / /c r e a t e di nt h ed e s i g n e rv i e w . a d a p t e r . F i l l ( D s ," m y _ d t " ) ; i f( D s . T a b l e s [ 0 ] . R o w s . C o u n t= =0 ) { M e s s a g e B o x . S h o w ( " N od a t aF o u n d " ," C r y s t a l R e p o r t W i t h O r a c l e " ) ; r e t u r n ;
.codeproject.com/KB/cs/Cr stalReportNDataTable.asp
6/8
05/12/11
Cr stal Report
Poin
M U C A C
of In e e
: C R ) O ( C# ) Q (P SQL MDI MDI
HTTPS SSL ,
Licen e
T L , (CPOL) , T C P O
Abo
he A
ho
S E 4
, I S ( VB 6.0.
, , O .NET
C KSA A
I O F
E
, C .)
Poor
E cellent Vo e
Commen
Yo m FAQ
and Di c
e hi me
ion
age boa d. ( - ) Search
Sign In o
P R M o e of 5
Medi m
Normal
25
Upda e F P N
amine al epo knai bala enka a i a amk ma hebinbacka E e nal Da a e E adding col mn ing da a e D o da a able and da a able ami .k ma .13 S hi M _5862
da a no di pla ed in c M M o e of 5 o e of 3 i ho
Repo R :R
ni in.mail20 a k iala
.codeproject.com/KB/cs/Cr stalReportNDataTable.asp
7/8
05/12/11
Ver
thanks
Cr stal Report
18:32 25 Mar '09 21:04 22 Oct '08 11:45 3 Sep '08 1:52 6 Sep '10 1
Cr stal Report with DataSet and DataTable using C# responce Please Vote This Article Re: Please Vote This Article Last Visit: 7:49 1 Dec '11 General News Last Update: 6:54 5 Dec '11 Suggestion Question Bug
Answer
Joke
Rant
Admin
Use C trl+Left/Right to switch messages, C trl+Up/Down to switch threads, C trl+Shift+Left/Right to switch pages.
P ermalink | A dvertis e | P rivac y | M obile Web0 4 | 2 .5 .1 1 1 2 0 3 .1 | L as t U pdated 8 Sep 2 0 0 8 L ayout: fixed | fluid A rtic le C opyright 2 0 0 8 by Rehan A hmad A bbas i E verything els e C opyright C odeP rojec t, 1 9 9 9 - 2 0 1 1 T erms of U s e
.codeproject.com/KB/cs/Cr stalReportNDataTable.asp
8/8