Help with subreport


B

brian

I have not been able to get data into my subreport. Using VS2005, VB.Net, Crystal.

In the code below, textbox.1 does get populated with the correct rowcount. The only thing I see on the sub report is the heading, but no data.

Main report works fine. I would appreciate if someone can provide any code I may be missing or a link to an example of how to do this correctly in vb.net. I have google for a day and 1/2.

Dim Cnn As New Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings.Get("Sqlcnn"))

Dim Cmd As New SqlClient.SqlCommand()

Cmd.Connection = Cnn
Cnn.Open()
Cmd.CommandText = "Select * from CC"
Cmd.CommandType = CommandType.Text
Dim DA As New SqlClient.SqlDataAdapter()
DA.SelectCommand = Cmd
Dim DS As New Data.DataSet
Dim Rpt As New ReportDocument
Rpt.Load(Server.MapPath("~") & "\MainReport.rpt")
'This is our DataSet created at Design Time
DS.Dispose()
DA.Fill(DS, "Stores")

Cmd.CommandText = "Select * from tRecipe"
Cmd.CommandType = CommandType.Text
DA.Fill(DS, "trecipe")
Cnn.Close()
Me.TextBox1.Text = DS.Tables("trecipe").Rows.Count


Rpt.SetDataSource(DS.Tables("Stores"))
Rpt.Subreports("SubReport.rpt").SetDataSource(DS.Tables("tRecipe"))
' Rpt.OpenSubreport("SubReport.rpt").SetDataSource(DS.Tables("trecipe")) have tried this too
CrystalReportViewer1.ReportSource = Rpt

End Sub



--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top