|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionThis article is about creating Crystal Reports using C#.NET. About two weeks back, one of my friends asked me this kind of example, also he searched through the Internet and he told that he couldn’t find a sample. When I was doing this kind of developments I’m also looked for samples, but I couldn’t find one. That’s why I did this article to CodeProject without creating reports separately using Crystal Reports other than using .NET IDE. Create a DatasetFirst you should create a Dataset to get the data from the DB. By clicking the “Add New Item” in the “Project” menu you can add a Dataset. A picture of an added Dataset is looks like the following window and can add elements to the Dataset by dragging and dropping elements from the toolbox. This Dataset is used to fill the data, which is getting from the DB by using a query. Because of that the names of the elements in this Dataset should be equal to the names of the elements in the DB. For an example this Dataset can fill using the following query.
String connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\..\\myDB.mdb;User ID=Admin;Password="; OleDbConnection conn = new OleDbConnection(connString);
conn.Open(); string query = "SELECT studentID, firstName, lastName, birthDate, address, contactNo FROM studentInfo"; OleDbDataAdapter oleDA = new OleDbDataAdapter(query,conn); ![]() Create a Report using
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms
of Use
Last Updated: 13 Jan 2006 Editor: |
Copyright 2006 by Ishara Gunarathna Everything else Copyright © CodeProject, 1999-2008 Web08 | Advertise on the Code Project |