Skip to Content
author's profile photo Former Member
Former Member

Datasets

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2011 at 01:41 PM

    I am not well versed with doing formulas like this, but I do know that when you have tables that do not have matching records you need an outer link to get all records from table #1 and related records from table #2 (& 3 & 4 & etc.). Equal links will not work

    Debi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2011 at 01:50 PM

    still unsure sorry !

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2011 at 02:28 PM

    Ok - I get you, but rather than put it into one statement I could call them separately (datasets) - i am unsure of how the correct coding to display the strings/datasets ?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2011 at 02:34 PM

    Visual Studios 2010 and im sure CR 11

    thanks for your help debi !!!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.