Connecting Tech Pros Worldwide Forums | Help | Site Map

data is nt seen in Cyrstal report in VB.net when there are twio or more table in DS..

Newbie
 
Join Date: May 2009
Posts: 1
#1: May 5 '09
I am preparing a crystal report for library system...
two tables..

1)BookIssueDetail:

fields : grno ,bookno,issuedat

2)studentMaster

fileds: grno,stdename,(and lots more)..only these filed are req to display...



now i have made a dataset : "bookissuedataset" which have two table which are assign above.

these is my code on print button

**********

Dim str, str1 As String
Dim bookno As Integer

str1 = "Select bookno from bookmaster where bookname = '" + cmbName.Text + "'"
cmd = New OleDbCommand(str1, cn)
dr = cmd.ExecuteReader

If dr.HasRows Then
While dr.Read
bookno = dr(0).ToString
End While
End If

Dim l As New BookIssueDetail //this is my report name

str = "select BookIssueDetail.grno,StudentMaster.StudentName,Boo kIssueDetail.BookNo,BookIssueDetail.IssueDate from BookIssueDetail inner join studentmaster on studentmaster.grno=BookIssueDetail.grno where BookIssueDetail.bookno =" + bookno.ToString


da = New OleDbDataAdapter(str, cn)
Dim ds As New DataSet
da.Fill(ds, "BookIssueDetail,StudentMaster")
l.SetDataSource(ds)


Dim frm As New frmReportVeiwer(l) //this call a new form which have only reportviewer added in it.its code is dislpaly below
frm.Show()
**********


Public Class frmReportVeiwer

Public Sub New(ByVal l As CrystalDecisions.CrystalReports.Engine.ReportDocum ent)
InitializeComponent()
CrystalReportViewer1.ReportSource = l
CrystalReportViewer1.Refresh()
End Sub


End Class
*******


this is my code...this work fine when i have only one table in my dataset but when i have 2 or more table in my dataset then my crystal report cpe blank.no field is displayed..
..all d report dislay all the field when i have only one table in my dataaset..

pleae guide me in this matter..
i dont know i m missing a big ort small point here but this thing is killing me...my almost proj is done but i am stuck on this thing..

Familiar Sight
 
Join Date: Mar 2008
Posts: 141
#2: May 6 '09

re: data is nt seen in Cyrstal report in VB.net when there are twio or more table in DS..


Try to set the specific table to the report instead of setting dataset as the datasource.

Eg:
l.SetDataSource(ds.Tables("BookIssueDetail"))
Reply

Tags
crystal report, dataset, vb.net