cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports 13 VS2010 Report does not display new data

Former Member
0 Kudos

The project is written in VS2010 connecting to an Access 2007 DB. It is running on a local network. All reports work fine from the standpoint that data is displayed on the reports HOWEVER, if a data table is updated the newley entered records do not show up on the report yet when I examine the database the records have been added to the table.

I hit refresh and the new records still do not appear. I've closed out the session and re-started the software and the records do not appear. It's almost as if the DB is 'frozen'. Suggestions?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Moved to .NET SDK forum.

Use the report.refresh in the viewer code. And also check off the option to use Saved Data in the report.

Don

Former Member
0 Kudos

Don,

Have done both use the refresh button in viewer code and have made sure the 'Save Data' box is unchecked. Neither of these resolved my issue.

0 Kudos

Is this a Windows or WEB app?

Hitting the Refresh button in the viewer should hit the database again. Something is caching the data, it's not CR. The Refresh will force a database read to happen.

If you close the viewer right away when new data has been added and then run the same report do you now see the new data?

How are you connecting to the database, OLE DB, ODBC or the Native Jet engine and are you using a Data set or hitting the db directly?

Thanks

Don

Former Member
0 Kudos

Don,

This is a Windows application.

The data appears in the data table immediately after saving the record, or record modifications. I don't know if I understand your comment "something is caching the data". I understand that it shouldn't be CR because it is simply reporting on data it sees in the table. I can not only see the record in the data table but I can run the 'modify' routine which displays the record on a form and all record data is present for the new record so the software application is seeing the record in the table. As you used the term I understood it to mean that the data is getting hung up somewhere and not being included in the data table. Did you mean something else?

The new data is not displayed if I hit the refresh button or if I close and re-run the report.

The application connects to the data using the Data Source feature of VS, in essence an ODBC connection. The report hits the DB directly. All reports are attached to the DB using the 'data connectivity' feature of CR.

Perhaps if I explain how I am using the report process might point us to an answer. In VS2010 I have created all of the reports using a CR report originally designed in an earlier CR version (8.5). I request a CR report form, choose select "from an existing report", select the old report and then: 1) Select data connectivity converting the 'old' location of the earlier report to the new location on drive S. I test the report by displaying data, making any minor format modifications I might have to make, then 2) Creating a new windows form, inlcuding a CR reader then attaching the defined report to the reader. 3) There is a report menu in the application containing a series of buttons which open the windows report form when selected.

In my development environment I was writing to the same database located on a 😧 drive. The development system automatically updated the 'user' DB on a logical S: drive emulating the end user customer's setup. In development all reports pointed to the S: locigcal drive and all reports worked. I have now changed the connection on the development side from 😧 to S:. As stated, all new data appears in the data table (the way it should) just not in the report.

I have tried the following after reading your current message: 1) Opened the CR report and tried to display data. All data is displayed EXCEPT for new records. 2) Re-connected the report to the S: drive, still no new data.

Any additional suggestions? Thanks.

0 Kudos

How about simplifying the whole process.... Create a new app, copy your code over to get the data and populate the dataset and then create a new Report off that dataset and preview it in the IDE Viewer to verify it works the first time.

Then add the 3 lines of code to view the report in the app. Update the data, create a button to refresh the dataset and then hit the Refresh button in the CR viewer.

Don

Former Member
0 Kudos

Don,

Not sure if e-mail got back to you. Here is my response

Don,

Not following your suggestion. What do you mean by create a new app? The current app has over 300 forms and some fairly complicate code so I don't think you mean a new app in that sense. The report was working before with no code, just the report and the display page. I'd be happy to try the three lines of code, where do I place them? Is it in the VS application OR in the CR report? Would you please provide a sample of the code you are suggesting?

Thanks.

Edited by: kdw_123 on Jun 28, 2011 7:47 PM

0 Kudos

OK,

Create a new app, set your framework to 4.0. Add a button to the form and then add the CR.Windows.Forms viewer to the form.

Create a new report outside of the IDE or inside if you want. Select your DSN to your MDB and drop on a few fields that will be updated. Save the report and be sure the Saved Data option is checked off, this forces CR to refresh the data against the DB.

These are the 3 lines of code you need to view a report:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument

rpt.Load("c:\reports\world sales report.rpt")

CrystalReportViewer1.RefreshReport()

CrystalReportViewer1.ReportSource = rpt

End Sub

End Class

Click on the Button1 to preview. Now add data to your MDB and then hit the refresh button in the CR Viewer.

Do you see the new data? If not then hit the Button again... If so then you are going to have to go through your code to determine where the data is being cached.

Don

Former Member
0 Kudos

Don,

Have spent several hours on phone with MS techncial support and here is what is happening.

1. When first starting this project the DB, etc. was located on the development system 😧 drive. During development, all CR reports were defined using a data source location to the 😧 drive. All reports worked fine.

2. During development, the end user's system was set up on an S drive (the common drive on the customers site). Test data was written to the 😧 drive but also copied to the S drive location to emulate the customers system.

3. Prior to installation, all DSN definitions were changed to the S drive as were the data source locations of the Crystal Reports.

4. Final testing worked well on the development system. All data appeared on the reports and "remained in the database".

5. It appears that with CR13 the change to the data source (S drive) was not applied. Although the definition shows the S drive, the default location stilll points to the 😧 drive on the development system. Since the system is no longer writing data to the 😧 drive (development system) the new data is not there. This is why the information is not appearing in the reports.

6. I have tried several times to change the data source location where the default to D drive is not showing active. The refresh button is ghosted out so this is not an option.

Please advise, is there something I am missing when trying to change the data source location? Please note, we have salted the file with dummy records (on D drive ) and the dummy records show just fine. After trying to run the report, the database on the 😧 drive over writes the DB on drive S (complete with dummy records) and this is why the data appears to disappear.

Please note, I have created a new CR report, assigned a data source to the S drive and all data appears on the report as it should. I need to know how to change the data source so it points to the correct drive without having to re-do all of the reports in this application.

If you would like screen shots of what I am talking about, please provide an e-mail address and I will send along.

Suggestions?

Thanks.

KDW

Edited by: kdw_123 on Jul 6, 2011 1:54 AM

former_member183750
Active Contributor
0 Kudos

The code to point a report at a different location of an MDB is described in KB [1218178 - Error: "Logon failed" when connecting to Access database in .NET application|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313338333133373338%7D.do].

I last used the code with CR 2008 and .NET 2008 and it worked fine in that version. It should work for CRVS2010 as I do not believe that part of the product was altered when it was upgraded to CRVS2010. Can you try the code and see if you get the correct data? If not it may be a CRVS2010 issue...

- Ludek

0 Kudos

Hey Ludek,

Problem with that sample is it hits the MDB directly and not the ODBC DSN. The Jet engine is being deprecated by MS so the solution is to use ODBC or OLE DB to any version of Access.

I've posted this multiple times but here it is again:

Try using the replace connection method to update the location of the DSN:


private void ReplaceConnection_Click(object sender, EventArgs e)
{
CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
ISCDReportClientDocument rcd;

rcd = rptClientDoc;

rptClientDoc.DatabaseController.LogonEx("dwcb12003", "xtreme", "sb", "pw");

//Create the logon propertybag for the connection we wish to use
CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag logonDetails = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();
logonDetails.Add("Auto Translate", -1);
logonDetails.Add("Connect Timeout", 15);
logonDetails.Add("Data Source", "dwcb12003");
logonDetails.Add("General Timeout", 0);
logonDetails.Add("Initial Catalog", "Orders");
logonDetails.Add("Integrated Security", "True");
logonDetails.Add("Locale Identifier", 1033);
logonDetails.Add("OLE DB Services", -5);
logonDetails.Add("Provider", "SQLOLEDB");
logonDetails.Add("Use Encryption for Data", 0);
logonDetails.Add("Owner", "dbo"); // schema

//Create the QE (query engine) propertybag with the provider details and logon property bag.
CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag QE_Details = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();
QE_Details.Add("Database DLL", "crdb_ado.dll");
QE_Details.Add("QE_DatabaseName", "Orders");
QE_Details.Add("QE_DatabaseType", "OLE DB (ADO)");
QE_Details.Add("QE_LogonProperties", logonDetails);
QE_Details.Add("QE_ServerDescription", "dwcb12003");
QE_Details.Add("QE_SQLDB", "True");
QE_Details.Add("SSO Enabled", "False");
QE_Details.Add("Owner", "dbo");

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo newConnInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo oldConnInfo;
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfos oldConnInfos;

oldConnInfos = rcd.DatabaseController.GetConnectionInfos(null);
for (int I = 0; I < oldConnInfos.Count; I++)
{
oldConnInfo = oldConnInfos;
newConnInfo.Attributes = QE_Details;
newConnInfo.Kind = CrystalDecisions.ReportAppServer.DataDefModel.CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
rcd.DatabaseController.ReplaceConnection(oldConnInfo, newConnInfo, null, CrystalDecisions.ReportAppServer.DataDefModel.CrDBOptionsEnum.crDBOptionDoNotVerifyDB);
}
}

See if that works for you. You'll have to change the info to ODBC from OLE DB. You can get the info from an app also, Ludek has a link to it, it will generate code to use RAS to set log on info...

Don

Former Member
0 Kudos

Don, PLEASE NOTE I e-mailed you some 'screen shots' documenting comments below but shots did not transfer to this post.

As you can see by the screen shot below I am using OLE DB as the connection. It is not set up as a Jet connection to the DB.

This is what I received when I tried the link provided by Ludek that you suggested. THIS WAS AN ERROR 404 Information not available.

Part of the problem I experienced when trying to set up an ODBC connection was that CR13 does not recognize a DB with the extension .ACCDB, only MDB when trying to set up an ODBC connection. In Ludek's post he mentions an MDB extension but not the newer .ACCDB extension.

As stated, if I define a new report using my existing connection to the S drive the report works wonderfully well. Logic tells me that the problem is not with the connection, only in the resetting of the data source as it is only those reports originally defined with a D drive data source that have a problem.

For whatever the reason, I cannot change the data source location through CR13. The refresh option is ghosted out and, as you can see from above, I am using an OLE DB connection which you recommend.

While I appreciate the extensive code sample you provided, I have no idea if I incorporate this into each report, if it is a utility run one time only of if it is something that must be run periodically by the end user customer - what? Given the fact that my existing connection is working well with a new report is it even applicable to the problem?

I agree with Ludek's observation that it worked in the past (setting a new data source) using VS2008 and the version of NET in 2008 and should work now. Has Ludek tried setting a new data source using CR13, VS2010 and NET 4.0 using an .ACCDB version of Access? Perhaps if he tried this he would know what I am doing wrong or maybe discover a work around, assuming there is a problem?

Former Member
0 Kudos

Ludek,

Thank you for your suggestion. As you can see by my response to Don's suggestion my problem is not getting any form of log on error. If I create a new report using my existing S connection, all is well. There is no conflict with the location of the Database (ACCDB extension) and the folder containing reports.

Any further suggestions?

0 Kudos

CR for VS 2010 does support accdb files. What code are you using to set location to the new S drive?

Have you tried the replace connection method I posted?

Thanks

Don

Former Member
0 Kudos

Don,

I know that CR13 supports accdb files with your OLE DB connector. When I attempt to set up an ODBC connection I cannot see ANY accdb DB's, I can however see the older versions with the extensions of .MDB.

As to the code used to set the S drive (or D drive for that matter) I am using the connection definition features of CR13 to establish the connection.

Before I try to use the 'refresh' solution you offered would you please answer my questions about it in my earlier post.

Thanks.

Edited by: kdw_123 on Jul 6, 2011 11:25 PM

0 Kudos

Hello,

When I set up a new ODBC System DSN and Select Microsoft Access I get an option to select mdb or accdb. Looking at the Drivers tab I see MS has one and the file name is ACEODBC.DLL version 12.00.4518.1014

And it works for me....

What question?

Don

Answers (0)