Click here to Skip to main content
15,893,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to create a dynamic dataset with two data table such that I can use the dataset in the crystal report I want to put the values from access database and put the values into the two data tables in the dataset Right now I am able to use one dataset and one data table in the crystal report

What I have tried:

Private Sub ChallanReports_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If rpt2 = "ChallanBlack" Then
Dim objrpt As New ChallanBlack '' crystal report
Dim query As String = "select * from Challan where ChallID = " & dts2
Dim ad As OleDbDataAdapter = New OleDbDataAdapter(query, conn)
Dim ds As ChallanDataSet = New ChallanDataSet '''dataset
ad.Fill(ds, "Challan") '' datatable
objrpt.SetDataSource(ds)
CrystalReportViewer1.ReportSource = objrpt

ElseIf rpt2 = "BGLChallanBlack" Then
End If
End Sub
End Class
Posted
Updated 1-May-19 10:58am
v2

1 solution

If you have two tables and you want to create a view that contains data from both, create a view in your SQL Server and connect to that
 
Share this answer
 
Comments
NIRMAL90 1-May-19 21:27pm    
i want to create the dataset dynamically and in the dataset there is 2 tables. currently, i am using one dataset with one table dynamically data is put in the datatable. but how to put in the two datatable in dataset dynamically
Christian Graus 1-May-19 21:28pm    
A dataset is a class that exists to contain more than one table. That's easy to do.

https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/dataset-datatable-dataview/adding-a-datatable-to-a-dataset
NIRMAL90 2-May-19 11:03am    
The above code i am using to display record dynamically from dataset to datatable to crystal report. Please see the code and help me right now i can display only one table in crystal report i want to display records from 2 datatable from dataset
Christian Graus 2-May-19 17:45pm    
Oh, it's a Crystal Reports question. If CR will only show data from one datatable, why not generate one table with all the data you need?
NIRMAL90 4-May-19 22:12pm    
RIGHT NOW I HAVE DONE THAT ONLY

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