Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Database and Reporting > Crystal Reports


Reply
 
Thread Tools Display Modes
  #1  
Old 09-21-2011, 07:19 AM
zaco1988 zaco1988 is offline
Newcomer
 
Join Date: Sep 2011
Posts: 3
Thumbs down Crystal Reports


I need to gather information from 5 different tables.

I am writing to the datasets, but at runtime it does not show any data (an error).
I know the statement is correct as I have done it in a SQL browser.

I am using MySQL to call it and using a dataset to design the crystal report.

I did try calling it within one dataset, but there are more records in some tables than others so it dosen't show true values in the data, this is why I am using 1 tMySQL able to 1 dataset table.

Code:
Dim con As MySqlConnection
Dim myReport As New ReportDocument
Dim myData, myDataClient As New DataSet
Dim cmdMySQLData, cmdClient As New MySqlCommand
Dim daData, daClient As New MySqlDataAdapter

Dim proRef As String
Dim cliRef As String

proRef = "PRA50377"
cliRef = "CLA51291"

con = New MySqlConnection()

'Connection String
con.ConnectionString = "Location"

Try
con.Open()

cmdMySQLData.CommandText = "select ref as PROPERTY_ref, address_line1 as PRO_address_line1, address_line2 as PRO_address_line2, address_line3 AS PRO_address_line3, address_line4 AS PRO_address_line4, town as PRO_town, county AS PRO_county, fk_client_sell_ref, postcode AS PRO_postcode FROM tblproperty WHERE ref = '" & proRef & "' "
cmdMySQLData.Connection = con
daData.SelectCommand = cmdMySQLData
daData.Fill(myData)

cmdClient.CommandText = "SELECT ref, contact_name, no_name, address_line1, address_line2, address_line3, address_line4, town, county, postcode, phone1, phone2, fax, mobile, email FROM tblclient WHERE ref = '" & cliRef & "' "
cmdClient.Connection = con
daClient.SelectCommand = cmdClient
daClient.Fill(myDataClient)

myReport.Load("Location")

myReport.SetDataSource(myData)
myReport.SetDataSource(myDataClient)

myReport.Database.Tables(0).SetDataSource(myData.Tables(0))
myReport.Database.Tables(1).SetDataSource(myDataClient.Tables(0))
CrystalReportViewer1.ReportSource = myReport '
Catch myerror As MySqlException
MsgBox(myerror.Message)
End Try
Please help

Last edited by Flyguy; 09-21-2011 at 08:14 AM.
Reply With Quote
Reply

Tags
.net, crystal reports, dataset, reports


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->