简体   繁体   中英

Setting Crystal Report data source at runtime in c#

In advance, I've read all of the posts on here about dynamically changing the data source for your report at runtime and none of it seems to work. and Yes possibly it might be duplicate of lot of question asked here, the reason I am posting this is because none of those worked for me.

I developed a report against my development database using an MySQL ODBC connection. At runtime I want to pull the data from the production database. I've tried clearing the DataSourceConnections. I've tried the SetDatabaseLogon as well as Table.LogOnInfo, Table.ApplyLogOnInfo, SetConnection, everything.

I am using the pull method for getting the data, so CR has entire control over the mechanism used to fetch the data.

But when I am setting some other data source I am greeted with a logon screen for the database, I i check use itegrated security then it says logon failed and if I uncheck use integrated security checkbox then it shows unable to load report and an exception is thrown

Anyone have any ideas? I'm using Visual Studio 2010 and Crystal Reports 2011 developer edition.Apart from this my Database is in mysql and I am binding report with the MySQL Procedure.

Note: Both these database just differ in name, Infact they are same database just I have changed the name, so the procedure and the fields are same.

Thanks in advance.

Okay.. after banging my head for around a day on this issue I have found the solution:

While using pull method for getting the data, where you specify the datasource, instead of it being the IP address of the host, just give the name of the ODBC connection, and specify other stuff in the ODBC :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM