I have a db and i want to print reports from that.. can u please guide me how to do it? can u please give me a sample code.. i want to print a dataset.. is crystal reports a easy way to print? or i have to use print dialogue box?
@yogesh12
The best way it's like you said using crystal reports, you can do everything with the gui, just drag and drop a crystalreportviewer to a form, then add a new report, and configure everything... datasource, etc...
@yogesh12
The best way it's like you said using crystal reports, you can do everything with the gui, just drag and drop a crystalreportviewer to a form, then add a new report, and configure everything... datasource, etc...
can u please give me a piece of code?
PHP Code:
Dim da As SqlDataAdapter
Dim constr As SqlConnection
constr = New SqlConnection("xxxx")
Dim cmd As SqlCommand
cmd = New SqlCommand
da = New SqlDataAdapter("Select * from tbl", constr)
Dim ds As New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
Dim s As New CrystalDecisions.CrystalReports.Engine.ReportDocument
s.SetDataSource(ds)
CrystalReportViewer1.ReportSource = s
CrystalReportViewer1.Refresh()
CrystalReportViewer1.RefreshReport()
CrystalReportViewer1.Show()
First, the s var need to be the report document that you must have added to you project, something like CrystalReport1... When you add the report a wizard pop's up to configure the report.
First, the s var need to be the report document that you must have added to you project, something like CrystalReport1... When you add the report a wizard pop's up to configure the report.
Then when declaring the s has to be like this:
VB.NET Code:
Dim s As New CrystalReport1
And everything should work fine...
it gives me an error when i try to declare as
Dim s as new CrystaReport1
i used reportdocument but it also doesn't works..
Last edited by yogesh12; Jun 21st, 2009 at 08:03 AM.
Right click in the solution, add new item, and add new crystal report.
yup added.. condition is same..
Code:
Dim constr As SqlConnection
constr = New SqlConnection("xxxx")
Dim cmd As SqlCommand
cmd = New SqlCommand
Dim da As SqlDataAdapter
constr.Open()
da = New SqlDataAdapter("Select name from tbl", constr)
Dim ds As New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
Dim s As New CrystalReport1
s.SetDataSource(ds.Tables(0))
CrystalReportViewer1.ReportSource = s
CrystalReportViewer1.Show()
constr.Close()
got error while loading from db Failed to load from Database, DLL "crdbo_xxx.dll cud not be loaded.. mate i got ur point, but how to set the place where i can insert Datasets? and also is it possible to show each records seperately like
"Emp Name" (in Bold)
Qualification: "Field 1 " (from DB")
Work Exp: "Field 2 " (from DB")
That must be done at design time, you can't do that at runtime, at least with the version that cames with vs...
1. OPen the report in the main window
2. Open the tab of the field explorer (if you can't see it, just select crystal reports menu and select Field Explorer)
3. In the field explorer, right click in the database fields and then database expert, and configure your connection
4. After this you have a plus sign in the database fields, and you can select fields to insert in the report, drag and drop.
5. To insert other fields, you can use the Toolbox
That must be done at design time, you can't do that at runtime, at least with the version that cames with vs...
1. OPen the report in the main window
2. Open the tab of the field explorer (if you can't see it, just select crystal reports menu and select Field Explorer)
3. In the field explorer, right click in the database fields and then database expert, and configure your connection
4. After this you have a plus sign in the database fields, and you can select fields to insert in the report, drag and drop.
5. To insert other fields, you can use the Toolbox
so i need around 30-45 reports.. do i have to create them all at design time?