PC Review


Reply
Thread Tools Rate Thread

Add table to Crystal report in VB.NET

 
 
GatorBait
Guest
Posts: n/a
 
      8th Aug 2005
Hi all,


I have a VB.NET application that uses SQL server and Crystal.
Basically what I am trying to do is have a report in which the user can

select which fields will appear on the report. I have everything set
up correctly and working in a small sample project. I attempted to
incorporate it into my main project but I'm running into a problem
because the report has no table attached to it because the table I use
will depend on what fields the user selects to view on the report. My
question is how can I add a table to the report within the code?


Here is some code I am using to display the report. I am getting an
error saying "The report has no tables." I'm trying to figure out how
I can add the table at runtime...


Dim conn As New SqlConnection()
Dim daReport As New SqlDataAdapter()
Dim dsReport = New DataSet()
Dim rpt As New GeneralReport_P()
Dim aryHeadings() As String
Dim aryFields() As String


conn = GetMainConnSQL("UserName", "Password",
"ServerName")
daReport.SelectCommand = New SqlCommand()
daReport.SelectCommand.Connect**ion = conn
daReport.SelectCommand.Command**Text = "SELECT * FROM CLNMAS
WHERE City = 'Miami'"
daReport.Fill(dsReport, "tReportData")


rpt.SetDatabaseLogon("UserName*", "Password",
"ServerName", "DbName")
rpt.SetDataSource(dsReport.Tab**les("tReportData"))


Dim frm As New CrystalViewer(aryHeadings, aryFields, rpt)
frm.crvMain.ReportSource = rpt
frm.MdiParent = Me.MdiParent
frm.Show()

 
Reply With Quote
 
 
 
 
Thomas Wenning
Guest
Posts: n/a
 
      9th Aug 2005

"GatorBait" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
Hi all,


I have a VB.NET application that uses SQL server and Crystal.
Basically what I am trying to do is have a report in which the user can

select which fields will appear on the report. I have everything set
up correctly and working in a small sample project. I attempted to
incorporate it into my main project but I'm running into a problem
because the report has no table attached to it because the table I use
will depend on what fields the user selects to view on the report. My
question is how can I add a table to the report within the code?


Here is some code I am using to display the report. I am getting an
error saying "The report has no tables." I'm trying to figure out how
I can add the table at runtime...


Dim conn As New SqlConnection()
Dim daReport As New SqlDataAdapter()
Dim dsReport = New DataSet()
Dim rpt As New GeneralReport_P()
Dim aryHeadings() As String
Dim aryFields() As String


conn = GetMainConnSQL("UserName", "Password",
"ServerName")
daReport.SelectCommand = New SqlCommand()
daReport.SelectCommand.Connect**ion = conn
daReport.SelectCommand.Command**Text = "SELECT * FROM CLNMAS
WHERE City = 'Miami'"
daReport.Fill(dsReport, "tReportData")


rpt.SetDatabaseLogon("UserName*", "Password",
"ServerName", "DbName")
rpt.SetDataSource(dsReport.Tab**les("tReportData"))


Dim frm As New CrystalViewer(aryHeadings, aryFields, rpt)
frm.crvMain.ReportSource = rpt
frm.MdiParent = Me.MdiParent
frm.Show()

Hi Gator,

use a dataset.
http://support.businessobjects.com/c...tasets.pdf.asp
http://support.businessobjects.com/l...s/c2010929.asp
http://support.businessobjects.com/c...net_adonet.pdf
http://support.businessobjects.com/c...etdatasets.pdf

Greeting

Thomas


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending Crystal Report to Network Print Mailbox While Bypassing Crystal Report Viewer. John Smith Microsoft VB .NET 0 17th Jan 2007 04:17 PM
Example creating Table in Crystal Report =?Utf-8?B?RmFiaWFu?= Microsoft C# .NET 2 10th Nov 2005 02:05 PM
Change Crystal Report Zoom Level using percentages in Crystal Report Viewer (Dotnet) Alex Stevens Microsoft Dot NET Framework Forms 1 30th Jun 2004 12:34 PM
Change Crystal Report Zoom Level using percentages in Crystal Report Viewer (Dotnet) Alex Stevens Microsoft Dot NET 1 30th Jun 2004 12:34 PM
crystal report how to use more than one table 2003et Microsoft C# .NET 2 29th Mar 2004 09:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:44 AM.