Solved

How do you get MySql Data into Active Reports?

Posted on 2009-05-06
4
1,767 Views
1 Endorsement
Last Modified: 2012-05-06
I am learning about how to use Active Reports.  It looks very straight forward but they have their own custom DataSource object that holds and requests the data for the report.

For example their sample shows to get the data from MS Jet ODBC 4.0 you would use -->
this.DataSource = new DataDynamics.ActiveReports.DataSources.OleDBDataSource("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Program Files (x86)\\Data Dynamics\\ActiveReports for .NET 3.0\\Data\\NWIND.MDB;Persist Security Info=False", "SELECT Categories.*, Products.*\r\nFROM Categories INNER JOIN Products ON Categorie" +
                        "s.CategoryID = Products.CategoryID\r\nORDER BY Categories.CategoryName;", 30);

Then when the fetch data is fired the data is grabbed.


But My Database is MySql.  I can get data from the MySql and put it into a
System.Data.DataTable or System.Data.DataSource objects but cannot figure out how to hook this object to the report data.

Help on this matter is greatly appreciated.
1
Comment
Question by:dwkrueger
  • 2
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Wikkard
ID: 24321826
1. You will need to get the odbc connector for mySQL. http://dev.mysql.com/downloads/connector/odbc/

2. Then you need to create an ODBC data source for your mySQL database.

3. Once this is done you can build you active report.  Add a new active report to your project.

4. Now you need an OLEDB datasource for your report.  This datasource should use the "OLEDB provider for ODBC".

5.  Then you can select the ODBC connection made in step 2, as the data source for your report.

Hope this helps

0
 

Author Comment

by:dwkrueger
ID: 24321916
I've got the connector.  I know this sounds odd but I have always connected at runtime.  I have never relied on the 'Visual Studio Environment' to maintain my connectors.
So can you please elaborate on step #2.  How is this done? Attached is how I have been doing this.  This is a funny problem becuase I have been doing this for years and for others out there I am sure that  the step of "create an ODBC data source for your mySQL database."  probably seems so basic that anybody should know this.
 
Thanks in advance.
Dan

string conString = "Server=" + m_ConData1.ComputerName

                + ";Database=" + m_ConData1.Database

                + ";User ID=" + m_ConData1.DbUser

                + ";Password=" + m_ConData1.Password

                + ";CharSet=" + m_ConData1.CharacterSet;

MySql.Data.MySqlClient.MySqlConnection con = new MySql.Data.MySqlClient.MySqlConnection(conString)
 

 con.Open();

                System.Data.DataTable WorkingTable = new System.Data.DataTable();

                MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter(command, con);

                da.Fill(WorkingTable);

Open in new window

0
 
LVL 8

Accepted Solution

by:
Wikkard earned 500 total points
ID: 24324513
The problem I think is that active reports custom datasource probably cant work with ado.net providers other than the basic oledb and sql ones. Im guessing the oracle provider or mysql data providers arent supported.

To configure the odbc connection follow the following steps:
Going to control panel -> administrative tools -> data sources (odbc). Then go to the system dsn tab and click add. On the first step of the wizard select the mysql odbc driver then fill out the connection details. If you dont see the mysql odbc driver then you need to get it http://dev.mysql.com/get/Downloads/Connector-ODBC/5.1/mysql-connector-odbc-5.1.5-win32.msi/from/pick (but you said you did already).

Once you finish the wizard you should be able to access this odbc data source with active reports using the oledb odbc driver.

0
 

Author Comment

by:dwkrueger
ID: 24332401
I did find an example that illustrated using the same modality of connecting to the database at runtime.  In the ActiveReports for .net 3 user guid the Sample of "Unbound Data Sample"  on Page 180 of this pdf guide shows how to Connect datatables and other data  to the report.
Using the unbound data it does not matter where the data comes from and any method of collecting the data can then be used.
http://www.datadynamics.com/
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Object Oriented Best Practice 5 35
Expando 4 34
Office.Interop.Word Document - Detect Macros not working 16 26
XML & .net 5 20
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now