Visual Basic . NET 2003 with Crystal Report

  • 14 years ago

    I have 3 tables related (Employee, Employee_Place and Employee_Card)

    I can't find a method to display data in Crystal Report from the 3 tables.  In the main form I have a ComboBoxPlace and a DateTimePicker to select differents Employees and places.  Looking in the Web I found a method that uses DataSet but for only one table and one selection...trying to apply that for my case does not work.  Any idea...?  Thanks

     

     

  • 14 years ago

    Fellow developer,

       I actually had the same problem, check out this article on Microsofts website.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/crystlmn/html/crconincorporatingreportsintoapplications.asp

    Hope this helps :)

    -- Eric

  • 14 years ago

    Sorry, that wasn't the best link, this one is better.

    http://www.freevbcode.com/source/WalkthroughCrystalReport.zip

    NOTE!!!   You use the myDA.FILL command for every table on your dataset

    Example:

    myCommand.CommandText=<SQL Query>
    myDA.Fill(myDS,"table1")
    myCommand.CommandText=<SQL Query 2>
    myDA.Fill(myDS,"table2")
    ...

    I know it seems kinda odd, but trust me it works.





     

    --Eric

  • 14 years ago

    Ok...thankyou but How you created your DataSet?

    When I created mine on VB I drag the 3 tables and also I created the relations between.

    Then, MySQL looks like:

    Me.MyDataAdapter = New OleDb.OleDbDataAdapter("SELECT Employee.[Emp_ID]," & _

    "  Employee.[Last_Name], Employee.[First_Name],  Employee_Place.[PLace], Employee_Card.[Card]," & _

    "  Employee_Card.[Due_Date] FROM (Employee INNER JOIN Employee_Card" & _ 

    "  ON Employee.[Emp_ID] = Employee_Card.[Emp_ID]) INNER JOIN Employee_Place" & _

    "  ON Employee.[Emp_ID] = Employee_Place.[Emp_ID]" & _

    "  WHERE ( (Employee_Place.[Place] = @MyPlace) AND (Employee_Card.[DueDate <= @MyDate))", MyConn)

     

    In the form I have a ComboBox that displays the differents places and a DateTimePicker...it should filter the report.

    Actually it shows me every record that is filled on the DataSet...!

    I don't see just what I 'm looking for.

     

    Enzo

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The greatest performance improvement of all is when a system goes from not-working to working.” - John Ousterhout