cancel
Showing results for 
Search instead for 
Did you mean: 

Switch from Web Service to DataTable data source at run time

Former Member
0 Kudos

Hello,

I am using a web service XML data source and related web service XML Schema file at design time to create a report.  At run time, I am switching to a DataTable data source and am displaying the report as follows:

                Dim rptDoc As New ReportDocument
                rptDoc.Load(rptFileName)
                rptDoc.SetDataSource(dt)
                ReportViewer.ReportSource = rptDoc

The data table has the exact same field structure and schema as the web service.  Neither the web service for the results set or schema require any login information.  When I run this code on the development environment, it works perfectly.  When I run it on the web server, I am prompted to enter database login credentials, even though I'm not using a database for the results set nor does the DataTable require any additional parameters.  Please see the attachment for the prompt I am receiving.  I would expect that there would be no additional prompt at this point, except for report parameters.  Note in my ReportViewer I have the property set EnableDatabaseLogonPrompt="False".

Any help would be greatly appreciated!  Thanks

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Richard,

It's promting for log on because your app does not have access to the Data, it's going to be a permission issue in IIS.

Use ProcessMonitor or some other tool to see where you are getting likely an Access Denied Error.

Don

Former Member
0 Kudos

Hi Don, thank you for your answer.  When I launch Process Monitor and try to open the report, no error events are logged.  The Report Viewer is part of a forms-authenticated application and there is certainly no issue opening the data table.  I think the problem might be when assigning the data table as the data source to the report document; it seems like maybe a connection in the report doc should be cleared or updated somehow, but I'm not sure how to do this (I tried rptDoc.DataSourceConnections.RemoveAt(0) to no avail).  Any more hints would be appreciated.  Thanks again.

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

In addition to Don's idea.

I find that you may get prompted for the db login if the report is handed a datasource that does not agree with what it expects.  See if this wiki will help you determine if there is any such discrepancy.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

Thank you Ludek.  I had already read your wiki piece.  Like I mentioned, the web service and data table have the same exact structure and what I am doing works perfectly on the development machine; it's only getting this error when I move it to a production web server (dev machine is Win7; server is WS 2012).

Perhaps one easy way for me to handle this quickly is not to change the data source type (always keep it as the web service for both report development and report run time) - but I do need to change some of the parameters of the web service URI string at run time, e.g. from "/Integration.svc/GetDataView/463/en/3/50" to "/Integration.svc/GetDataView/463/en/3/62" (only the last number changes).  Could you please let me know the method or property to set to change the URI string for the XML web service data source (is it on the ReportDocument object?)?  I haven't been able to find that anywhere.  Thanks again, Richard.

Former Member
0 Kudos

Hi Ludek,

Would you have any advice on my last question - how to update the XML URI data source setting in a report document at run time?  The method rptDoc.SetDataSource() does not seem to have an overload that would accept a URI as an argument.  Thanks in advance for your help, Richard

former_member183750
Active Contributor
0 Kudos

Hi Richard

Apologies for the delay. Yesterday was a busy day on the phones and phone incidents take a way, way higher precedence to SCN. Today looks not much better, but we'll see... As total by the by . FTYI, phone incidents can be obtained here:

Crystal Single Case Technical Support - SAP Business Objects US Online Store | SAP Online Store

First thing to double check would be that on your dev you are actually getting data from the dataset, not the XML the report was created off of. E.g.; Does you app still work if you remove the XML?

Next, Question would be; was the crdbxml10.msi installed on that runtime computer?

- Ludek

Former Member
0 Kudos

Hi Ludek,

Thanks again for your reply.  Through another thread I was able to figure out how to update the XML Web Service data source, so instead of changing from the XML WS to a Data Table at run time, I've decided to keep it using the same WS but with an updated URL.  That works both locally and in production, and in fact for my application is probably a better architectural approach anyway.

Thanks again,

Richard