473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to Show Data from 2 Tables on Crystal Report

rizwan6feb
108 100+
I am developing a database application in Visual Studion 2008 (VB.Net) . I want to create a stock report which receives data from 2 different tables i.e Products and Stock. I have designed the report but it shows a blank report (only headings, but no data)
I have used the following code to populate report
Expand|Select|Wrap|Line Numbers
  1.  
  2.             Dim r As New rptStock
  3.             Dim ds As New DataSet("DataSet1")
  4.  
  5.             Dim da1 As New SqlCeDataAdapter("Select * from Products", db.getConnection)
  6.             Dim da2 As New SqlCeDataAdapter("Select * from Stock", db.getConnection)
  7.  
  8.             Dim dt1 As New DataTable("Products")
  9.             Dim dt2 As New DataTable("Stock")
  10.             da1.Fill(dt1)
  11.             da2.Fill(dt2)
  12.  
  13.             ds.Tables.Add(dt1)
  14.             ds.Tables.Add(dt2)
  15.             Dim dr As New DataRelation("pk1", dt1.Columns("Code"), dt2.Columns("ProductId"))
  16.             ds.Relations.Add(dr)
  17.  
  18.             r.SetDataSource(ds)
  19.             v1.ReportSource = r
  20.             v1.Show()
  21.  
v1 is an instance of crystal report viewer
Dec 5 '09 #1
3 4292
rizwan6feb
108 100+
I am still looking for help
Dec 6 '09 #2
NitinSawant
270 100+
create a stored procedure and call the stored procedure that returns datatable

cheers,
Nitin
Dec 23 '09 #3
maxamis4
295 Expert 100+
In this statement your query needs to be defined better. So the question is do you want specific fields that are relational or are you looking to view both tables in one report. If you are looking for relational values than create your query to reflect the proper joins. If you want to display both tables your best option is to create a union query which you can declare in the statement below. However we need more details on your tables. Starting with their relationship and details on foreign keys and primary keys. If they are not relational we need to understand their purpose.

dim da1 As New SqlCeDataAdapter
Dec 24 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sam | last post by:
Hello everyone, I have a table, which contains a picture column, I put URL info into it. "www.myweb.com/1.jpg..." I want to show this picture in my crystal report, I find some samples show the...
1
by: Maria | last post by:
Hello! I am new to Crystal reports an I have problems passing parameters form outside to Crystal report an creating a report with data from more than one table This is the problem: I have to...
2
by: Henry | last post by:
I am trying to write an application that allows me to dynamically load selected Crystal Report files, read the parameters from the report file, give the user a chance to enter relevant data in a...
3
by: Diggler | last post by:
I was working on a report that is populated with three different tables in a strongly-typed dataset. The tables are populated from custom objects rather than directly from SQL Server. I loop...
1
by: abc my vclass | last post by:
How to design and build reports which data source from business logic layer ? Is there any documents or tutorials explain the steps to design and build reports if my projects' data source from...
0
by: alex9128 | last post by:
Hi, I have a VB.NET program with several CR.NET reports using ADO.NET Datasets. It takes data from Visual FoxPro 8.0 database. I have also two computers with VS.NET 2003 installed on both of...
3
by: Tyranno.Lex | last post by:
I am using Visual Studio .NET 2003 and have successfully deployed a commercial web application written in C# and ASP.NET. I am now wanting to add reporting using Crystal Reports and am having a...
0
by: AboutJAV | last post by:
I created a crystal report with the report.rpt reportdata.xsd I created the a new dataset with the reportdata myreportdata = new reportdata(); That automatically created a new dataset...
7
OuTCasT
by: OuTCasT | last post by:
I know how to change the database and sqlserver for a crystal report Dim report As New ReportDocument Dim connection As IConnectionInfo Dim oldServerName As String =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.