
09-21-2011, 07:19 AM
|
|
Newcomer
|
|
Join Date: Sep 2011
Posts: 3
|
|
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.
|