on 08-22-2016 3:39 PM
Ok so I just stumbled across something unusual. I am new to the vb.net with crystal reports so keep that in mind. I have two applications that I have built using Visual Studio Professional 2013 that are referencing the same crystal report. One of them will run my crystal report without issue, but the second one is throwing an error saying it cannot load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, version 13.0.2000.0 ......
It must be something in the configuration of the second vb app but darned if I can see the difference between the two projects. On my dev machine both apps work perfectly but on the enduser machines the same error is reported in the second application. It must be something in my project that is missing in the second program. Any help much appreciated.
Cheers
Only reason it would try to log on is because you have one of the Verify Database options checked on.
To clarify, you are talking about when CR Designer logs the DB info, it will always try to log on without a password, it's always done that.
That error is always there, ignore it.
Odd Architect error, I don't recall ever seeing that one, sounds like a Windows message... whcih may suggest your MDAC drivers and ADO dependenciess may me "confused".
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks to your help Don I am making progress. I noticed that even though I had marked my development package to be x86, it actually wasn't doing that. I had to go mark it in another spot of my project. I am getting some of my reports opening now without the logon dialog box. I suspect the other ones I have messed up by playing with the odbc dsn names.
So it appears that I have found part of the issue. There was a tickbox checked that says Prefer 32 bit under the compile options. When I turned that off and rebuilt the solution the program goes further but is now coughing on sending the database password. This one has me stumped because I know for a fact that the username and password that are being passed are indeed correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is bringing up a database login screen. I notice that the database is not filled in. Since I posted my last response I noticed something else. The report that appeared to be working was in face using saved data so it was not querying the database. When I changed that, it too is prompting for logon information now in the app that I thought was working. So I have a consistent problem now.
Hi Scott,
First what SP are you using? 13.0.2000.0 is the assembly version, it never changes.
Look in Programs and feature or the Assembly folder for the file version.
If you are not up to SP 17 then do that first.
Second what is the PLATFORM you want to use, 32 or 64 bit? Doesn't matter if it sort of works.
If 32 bit then set your project properties to x86, build it and deploy your app to the users PC.
Uninstall what you had if it's not SP 17 and then install the SP 17 on the other PC.
Setup the DSN located in the \syswow64\odbcadm32.exe
If 64 bit then change your project to x64 and create the DSN in \system32\odbcadm32.exe
The reason the Server and DB are blank or grayed out is because CR can't find the DSN or client.
Don
I'm using 17 as 32 bit. The odbc works fine as I have connected to it using another much older reporting tool. I tried setting to x86 as suggested but I still get the dialog box for the login information.
To answer Dells question I am using crystalreportviewer with reportdocument. I have tried setting the login information with setdatabaselogon and that part succeeds. It is when I assign the reportdocument object to the reportviewer reportsource that it seems to blow up. I also tried some example code that sets a connection and passes the login information for each table of the report. The code seems to execute all of that without issues. It when the reportviewer get the reportdocument object that it blows apart.
If you are using ReportDocument, you need to set the table logons after you load the report and before you use it to set the ReportSource of the viewer.
Here is sample code from one of the links at the top of this space:
Step 1: Set the logons in the Report Document and put it in a session
protected void btnSubmit_Click(object sender, EventArgs e)
{
// Load the Report
ReportDocument boReportDocument = new ReportDocument();
boReportDocument.Load(Server.MapPath("Northwind SQL.rpt"));
// Create a ConnectionInfo
ConnectionInfo boConnectionInfo = new ConnectionInfo();
boConnectionInfo.ServerName = txtServer.Text;
boConnectionInfo.DatabaseName = txtDatabase.Text;
boConnectionInfo.UserID = txtUserID.Text;
boConnectionInfo.Password = txtPassword.Text;
// Modify the ConnectionInfo for all tables in the main report
ModifyConnectionInfo(boReportDocument.Database, boConnectionInfo);
// Modify the ConnectionInfo for all tables in all subreports
foreach (ReportDocument boSubreport in boReportDocument.Subreports)
{
ModifyConnectionInfo(boSubreport.Database, boConnectionInfo);
}
// Store the ReportDocument in HttpSession for use on the next page.
// Remember to Close() Dispose this later when not needed.
Session.Add("Report", boReportDocument);
Response.Redirect("viewreport.aspx");
}
private void ModifyConnectionInfo(CrystalDecisions.CrystalReports.Engine.Database boDatabase, ConnectionInfo boConnectionInfo)
{
// Loop through each Table in the Database and apply the changes
foreach (CrystalDecisions.CrystalReports.Engine.Table boTable in boDatabase.Tables)
{
TableLogOnInfo boTableLogOnInfo = (TableLogOnInfo)boTable.LogOnInfo.Clone();
boTableLogOnInfo.ConnectionInfo = boConnectionInfo;
boTable.ApplyLogOnInfo(boTableLogOnInfo);
// The location may need to be updated if the fully qualified name changes.
//boTable.Location = "";
}
}
Step 2: Assign the ReportDocument to the viewer
public partial class viewreport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Make sure there is a report in session
if (Session["Report"] == null)
Response.Redirect("default.aspx");
// Set the ReportSource of the viewer to the ReportDocument stored in session
CrystalReportViewer1.ReportSource = Session["Report"];
}
protected void btnClose_Click(object sender, EventArgs e)
{
// Clean-up code for Crystal Reports - Don't forget to do this when you're done with the report...
CrystalDecisions.CrystalReports.Engine.ReportDocument boReportDocument = (CrystalDecisions.CrystalReports.Engine.ReportDocument)Session["Report"];
boReportDocument.Close();
boReportDocument.Dispose();
Response.Redirect("default.aspx");
}
}
-Dell
You said you were using a much older piece of software and it connects. Is the old connection using ODBC 2?
Open the report in CR Designer and export to RPT format, this saves data with the report. Or refresh the report and save data with it.
Now in a simple WEB app using the code below load the report and preview it.
Now hit the Viewers Refresh button, this should prompt you for DB connection info according to the database connection info saved in the Report. If the Server or DB name is grayed out it means the application CAN NOT find the DB client, it's as simple as that.
Make sure IIS is running under an system account and that system account has access to the DB client.
Enable CRLogger, search for how to, run that on the app server when CR runtime is installed and see what it shows for the report with saved data and your app.
Keeping the report in Session and Postback is a must:
public partial class _Default : System.Web.UI.Page
{
CrystalDecisions.CrystalReports.Engine.ReportDocument rd;
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;
protected void Page_Init(object sender, EventArgs e)
{
rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
CrystalDecisions.CrystalReports.Engine.Database crDatabase;
CrystalDecisions.CrystalReports.Engine.Tables crTables;
CrystalDecisions.Shared.TableLogOnInfo tblogoninfo;
CrystalDecisions.Shared.ConnectionInfo cninfo;
string url = @"D:/Atest/MyReport.rpt";
rd.FileName = url;
#region Session
if (Session["rd"] == null)
{
try
{
rd.Load(url, OpenReportMethod.OpenReportByTempCopy);
rptClientDoc = (CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper)rd.ReportClientDocument;
// not using RAS then use
// Session.Add("rd", rd);
Session.Add("rd", rptClientDoc.ReportSource);
}
finally
{
// open the database connection
//myConnection.Close();
//rptClientDoc = rd.ReportClientDocument;
}
}
#endregion Session
CrystalReportViewer1.Height = 300;
CrystalReportViewer1.Width = 300;
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
// set up the format export types:
int myFOpts = (int)(
CrystalDecisions.Shared.ViewerExportFormats.RptFormat |
CrystalDecisions.Shared.ViewerExportFormats.PdfFormat |
CrystalDecisions.Shared.ViewerExportFormats.RptrFormat |
//CrystalDecisions.Shared.ViewerExportFormats.XLSXFormat |
//CrystalDecisions.Shared.ViewerExportFormats.CsvFormat |
//CrystalDecisions.Shared.ViewerExportFormats.EditableRtfFormat |
//CrystalDecisions.Shared.ViewerExportFormats.ExcelRecordFormat |
//CrystalDecisions.Shared.ViewerExportFormats.RtfFormat |
//CrystalDecisions.Shared.ViewerExportFormats.WordFormat |
CrystalDecisions.Shared.ViewerExportFormats.XmlFormat |
CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat |
//CrystalDecisions.Shared.ViewerExportFormats.AllFormats |
CrystalDecisions.Shared.ViewerExportFormats.ExcelRecordFormat);
//CrystalDecisions.Shared.ViewerExportFormats.NoFormat); // no exports allowed
//int myFOpts = (int)(CrystalDecisions.Shared.ViewerExportFormats.AllFormats);
CrystalReportViewer1.AllowedExportFormats = myFOpts;
CrystalReportViewer1.ID = "ReportUsageDetailByArea";
// this sets the report to the session
CrystalReportViewer1.ReportSource = Session["rd"];
CrystalReportViewer1.EnableParameterPrompt = true;
CrystalReportViewer1.HasToggleParameterPanelButton = true;
}
rd.Close();
rd.Dispose();
}
If all of that does not work try repairing VS and CR for VS, make sure you are a local PC admin and your AV software is not blocking access to anything CR runtime.
Try searching for what ever error you are getting also, with the missing assembly.
Don
Ok, so I stepped away from this for a couple of weeks just to get some other work completed and give it a break. As a test, I created a new ODBC connection which uses Driver 11 for SQL Server. I created a brand new report that accesses two tables. I then recreated the ODBC connection on a client computer. I have since loaded a demo of cyrstal reports on the client machine so that I could open the report in cr and it runs fine on that computer under crystal reports. When I call this report in the crystal viewer however it brings up the logon screen and tells me that it failed the logon. The server name, database name, login id are all correct on this screen and I know I am giving it the correct password. Why will it run perfectly in crystal reports but not when being called from visual studio using crystal reports viewer??? The exact same activity happens on the client pc and my development pc.
Hi Scott,
I have attached a sample code for setting the DB logon. It will only set the DB logon, if it is successful it will ask you for parameters. Let it do that pass them manually and then we can pass the parameters from code as next step. For now lets just troubleshoot the DB logon.
I did not get your previous update. Can you be more specific when is the test connectivity failing.
Regards,
Vinit
I was checking the connectivity after each table has the security applied. I ran your code that you attached but supplied my report and logon information. It is still telling me there is a failed login. Everything looks correct, I even tried giving a bogus server name and failed right away with a different message so I know part of it is working correctly.
Just for the fun of it. I added a new form and dropped on the crystal report viewer. I used the drop down menu of that object to create a brand new report from scratch that uses one table with only a handful of rows in it. No prompts or anything, simply a list view. I can preview the data just fine while in Visual studio in design mode of the report. However, when I go to run the application in debug mode, it stops me asking for login information when I open this form.
You will have to forgive my ignorance here Don. I am taking it that there is an ini or more likely xml file that I need to add these options in order to enable the logging tools. Can you direct me as to what folder this would be in. There is like a gazillion subfolders in my \program files(x86)\sap business objects.
Nope, from the Start menu in Windows Search type in System Environment, it's not a CR part, and it will allow you to edit them.
Create a folder on your C drive and label it "logging"
Add the 3 variables and restart your app and/or CR Designer and it will start generating the database log with our API's used.
The file used is crlogger.dll, it comes with CR Designer and SDK's.
Don
Ok I am making head way now Don. The logs are telling me that there is a architecture mismatch between the driver and the application. This is quite curious because as a test I created a new odbc connection called SQLTest to create a new report from so that there would be no doubt which odbc was being used.
Just for the fun of it, I opened crystal reports up and loaded up the report. It also reports an instance of logon failure to this datasource but then there is a second successful login after that recording. I am assuming that it tries to connect to the database when you open a report but it doesn't have the password and thus fails? Also, right at the top of the log file for crystal reports there is an error reported as follows:
..\cserrif.cpp 523 Error 14722 (..\csdll.cpp, 117): : c:\Program Files (X86) SAP Business Objects\SAP BusinessObjects Enterprise XI 4.0\win32_86\crw32_res_xx.dll
Have both applications been installed an the same machines? If not, are you installing the Crystal for VS runtime on all of the machines? Does the application you're having issues with work when it's installed on the same machine where the other appliction does work?
Note that the "bit-ness" of the runtime MUST match the bit-ness of the application, which may not be the same as the bit-ness of the computer. So, if you're compiling the application as 32-bit, you must install the 32-bit runtime, regardless of whether the machine is 32-bit or 64-bit.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A have two machine on the network that are running both of these applications. One application will display the crystal report on both computers. The second application fails on both computers which tells me that the runtime environment is configured correctly, but that I have missed something on the second application in the project. I have the added references to the crystal decisions dll files in both applications. I know it is some simple little thing.
User | Count |
---|---|
78 | |
10 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.