Solved

How do you get MySql Data into Active Reports?

Posted on 2009-05-06
4
1,812 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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