Connecting to Crystal Reports 4.6 from VB - vb.net

How can I connect to a Crystal Reports 4.6 report that connects to SQL Server 2005 as a data source, using Visual Basic?
I don't want to specify the connection string in the report. I want to pass the connection from VB. Is there any way to do this?

A long time ago I worked on Crystal 4.5 (I don't remember a 4.6). The way to change the connection details is still pretty much like it is today - Find the tables collection for each report and set the location & log on information for each one. Sub reports were a pain though. You had to go through each section of the report to find out if it contained a subreport, then get its table collection.

Related

SQL Server 2005 Report Manager - data source connection info deleted?

Just started a new job and one of my duties is to create/alter reports and make them accessible on our report server for the rest of the company. I've created a new report (from an existing report) in Visual Studio 2005 and it works fine in VS. After I Upload the file to the report server using Microsoft SQL Server Report Manager and try to view the report it says "The report server cannot process the report. The data source connection information has been deleted. (rsInvalidDataSourceReference)"
I checked in Properties > Data Sources and the first option "A shared data source" is selected with a alert next to it saying "The shared data source reference is no longer valid". The odd thing is that the original report that I used to create this one has the same alert and same settings, but it executes fine. They are very similar - original reports by year and the new one is by month.
I'd really appreciate any help i can get on this one as I don't have anyone in the company I can lean on. I'm very unfamiliar with these applications so it could be that I just need some basic first steps to troubleshoot this issue.
Did you upload the datasource as well?

Connecting crystal reports to oracle database using vb.net code

I'm using crystal reports 9, visual studio 2008, and oracle 9i in this project I'm doing. My crystal reports pull data from an oracle database, and are displayed on a CrystalReportViewer on a windows form. How would I make this connection using vb.net code?
Imagine this little scenario:
The host name for the oracle server is myHost.
The database name is myData
The username is myUser
The password is myPass.
Please assist me with the code to make this connection.
Your help will be highly appreciated.
Basically, you have a few options. If you've created a connection inside of the Crystal Report then you can hand off different login credentials to the report and crystal will handle it. You have to do it in a specific way through or it won't work (it's very picky on the order in which it's done). You will loop through the report and all the sub reports handing off new crendentials. The second route is to use a DataTable as your DataSource, populate it via VB.Net and hand it off (this doesn't sound like the route you're wanting to go).
Here are two blog entries where I describe how to pass new login credentials off to Crystal.
https://www.blakepell.com/2010-09-17-crystal-reports-changing-the-database-connection-from-net-subreport-links-and-the-case-of-the-missing-parameter-values
https://www.blakepell.com/2012-05-22-crystal-reports-extension-methods
In the first blog entry there is a "Private Sub ApplyNewServer(ByVal report As ReportDocument)" that will show you how to pass your new login and server information. It was extracted from another class so it might need slight modification to reference the login parameters you want to pass in.
Best of luck. ;)

SQL Server Reporting Services VS rdlc and the ReportViewer

We are planning on creating reports to be run on the same computer that the database application is running on.
Can you tell me which of these is the best approach? (SQL Server Reporting Services or creating a rdlc ReportViewer report)
Also I tried to locate detailed rdlc ReportViewer report tutorials both in books and online and found none. It's probably because I'm looking in the wrong places.
We are also using VB.Net as the language.
All help will be appreciated.
In a nutshell, .rdlc is the client version. You cannot host these on the report server. These reports do not know how to fetch the data, you MUST get the data yourself and pass it to the report. For this reason, you cannot even preview the report while designing. ReportViewer.ProccessingMode = Local
The .rdl or server reports know how to fetch the data. You configure the datasource and upload them to the report server. Because of this, you can preview the reports while designing them. You can use the web/desktop ReportViewer control to run the reports from inside your app...like a proxy between your application and the report server.ReportViewer.ProccessingMode = Remote
I prefer rdl for any sql datasource, but rdlc is also good for cases where your datasource is very complex or can only be built through the application code. I think there might be ways to configure an object datasource for rdl but I haven't looked into that yet.

Failed to retrieve data from the database, Database Vendor Code 9421

I have a report made in Crystal Reports XI. The report is generated and exported to PDF in visual basic script using COM interface. Generally everything is running smoothly, but in one case generation breaks with error:
Failed to retrieve data from the database. Details: [Database Vendor Code 9421]
Database used is MSSQL 2005 connected over ODBC to CR XI. When I am opening report with exactly the same parameters in Designer, everything works fine.
It looks like it is data related, but it is hard to trace since the whole report is pretty sophisticated. Anyway I spent half a day on crawling over Dr. Google and it seems that he has no clue what might be an issue.
When you previewed the report in Crystal Reports Developer, did you look at the whole thing? Some custom formulae are not calculated until you actually look at the page.
Try scrolling through the entire report top to bottom. If your error message pops up halfway through and Crystal refuses to preview the rest of the report, then there's probably some anomaly in your datasource that is tripping up a custom Formula in your Crystal Report.

Crystal Reports

I have installed Crystal Reports and am using it in Visual Studio 2005.
Can anyone help me as to how i can use SQL Server 2000 to generate reports using Stored Procedures.
Im not sure i have understood the question. if you want SPs to write the RPT file for you then I cant answer.
What i have done for years is use Stored Procedures to do the heavy-lifting for the report. Simply create an sp with parameters. When you create your crystal report and adding data definitions in make sure that stored procedures are included. Then add parameters to the report which are inserted into the SP paramaters at runtime.
Using Views is also a good way to put all the data massaging work back onto the db server instead of the client. Send parameters from crystal to return a filtered dataset back to your report for printing.
Crystal Reports: Tutorials and Sample Code
http://msdn.microsoft.com/en-us/library/ms227881%28VS.80%29.aspx
Google search of "Crystal Reports Visual Studio Tutorial" returned that as the top result.
Start by creating a data source type of OLE DB, and choose your SQL Server Native Client. This option will be there for a new report, or if you set the data source; note that if you set a different data source for an existing report, your existing data fields may disappear from the report. Using integrated security is nice because you can control access to the data in the report in SQL Server.
Then in your database expert, click "Add Command", where you can call the shared procedure, add SQL, select your fields, etc.