Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a DataGridView where some selected data is displaying depending on select query with conditions.

Now i want that DataGridView to print in Crystal Report, which is there in another form.

How do i do that?

The code for DataGridView is as follows.
VB
Dim cn As New SqlConnection("Data Source=.\INSTANCE;initial catalog=record;user=sa;password=gariahat")

Dim ds As New DataSet
Dim tb2 As DataTable
Dim cmd As New SqlCommand("select * from fullsort where return_dt is null ", cn)

Dim da As New SqlDataAdapter(cmd)
tb2 = New DataTable
da.Fill(tb2)

FullsortDataGridView.DataSource = tb2
Posted
v3
Comments
sudeshna from bangkok 30-Sep-13 4:59am    
this is the code i wrote in crystal report for loading datagridview data to crystal report but its showing error. what is wrong in it?
aboubkr90 30-Sep-13 5:55am    
I can't see the rest of it but...
- Check 'cr1' and 'stock1'
- ReportSource is supposed to be 'ds' that you just loaded. Right?
sudeshna from bangkok 30-Sep-13 6:03am    
this error i am getting
Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
sudeshna from bangkok 30-Sep-13 6:03am    
Dim cn As New SqlConnection("Data Source=.\INSTANCE;initial catalog=record;user=sa;password=gariahat")
Dim ds As New DataSet
Dim dt As DataTable
dt = New DataTable()

ds.Tables.Add(dt)
cr1.SetDataSource(ds)
CrystalReportViewer1.ReportSource = cr1
sudeshna from bangkok 30-Sep-13 6:04am    
cr1 is the name of my crystalreport

1 solution

sudeshna from bangkok wrote:
this error i am getting
Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.

How to fix error Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.[^]
Errors Occurred when load the SAP Crystal Report in runtime[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900