on 06-24-2015 2:34 PM
I developed my reports against a development database. The reports are "executed" by a C# program that provides database login credentials for ASE 15.7 database. When I went to install reports into production they failed with a "Failed to retrieve data from database" exception. The C# program provided the correct login credentials for the production server. So, I said, let me try to connect to the prod server in the designer. Using the "Database Expert" I created a new connection to the prod server. No problem. I use the "Set Database Location" dialog to switch the report source(s); main and sub-reports. I refresh the report and it says "Failed to retrieve data from database" then "Database Connector Error: "Attempt to location entry in sysdatabases for database 'test3' by name failed - no entry found under that name.... Its like it logged into the prod server, but tried to use the test server's database name. In the "Database Expert" the database name is correct. How do I diagnose this? Is there problem changing the database name?
Thanks,
John
Hi John
I suspect your conclusion is correct. So the question would be once it logged into the server, why can it not access the database. I belie that the issue will be permissions.
Can you create a brand new report on the database that gives the error when you try to point to it in the existing report?
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow me on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ludek,
If I use the designer to change the "data source location" (and save the report) the report works against any of my databases. When I change login credentials to a database different from the one last specified in the designer, it fails to connect. I has tried to change credentials both by using SetDatabaseLogon() or directly changing the report object using the method below. When examining the object in the debugger, I haven't been able to detect the difference between when it actually connects and when it fails. Obviously there is a difference. Are you supposed to be able to switch databases programatically? Or is crystal designed to only connect to the database that is last specified in the designer? What am I missing? Please help!
Thanks,
John
private void setLoginCreds(ReportDocument rpt, string dbServer, string db, string uid, string pw )
{
Database crDatabase = rpt.Database;
Tables crTables = crDatabase.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in crTables)
{
TableLogOnInfo crTableLogOnInfo = aTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo.ServerName = dbServer;
crTableLogOnInfo.ConnectionInfo.DatabaseName = db;
crTableLogOnInfo.ConnectionInfo.UserID = uid;
crTableLogOnInfo.ConnectionInfo.Password = pw;
aTable.ApplyLogOnInfo(crTableLogOnInfo);
//bool b = aTable.TestConnectivity();
}
Sections crSections = rpt.ReportDefinition.Sections;
foreach (Section crSection in crSections)
{
ReportObjects crReportObjects = crSection.ReportObjects;
//loop through all the report objects in there to find all subreports
foreach (ReportObject crReportObject in crReportObjects)
{
if (crReportObject.Kind == ReportObjectKind.SubreportObject)
{
SubreportObject crSubreportObject = (SubreportObject)crReportObject;
ReportDocument crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
setLoginCreds(crSubreportDocument, dbServer, db, uid, pw );
}
}
}
}
Hi John
Yes, changing databases programmatically is a run of the mill thing...
I always recommend doing this in baby steps if it does not work initially;
Try a new test report, one table one field. No subreports. Does that work? If it does, have a closer look at the report you actually want to work with; Remove the subreport(s), try to run the report now. If that works, save out the subreport and try to run it on it's own. Does that work? If not, double check the connection type.
There is also a utility that you could use that will write out the code for you. See KBA 1553921 - Is there a utility that would help in writing database logon code?
- Ludek
Ludek,
Thank you for your reply.
I have written a super-simple report against a single table a no sub-reports. I get the same exact behavior as the other reports. Is there some nuance when using SAP ASE?
I tried the utility. It crashes on my reports, even my super simple report. What are "QE_LogonProperties"? They don’t in my report.
Dim boMainPropertyBag As PropertyBag = crCi.Attributes
Dim boInnerPropertyBag As PropertyBag = boMainPropertyBag.Item("QE_LogonProperties") No "QE_LogonProperties”
Dim propIDs As Strings
propIDs = boInnerPropertyBag.PropertyIDs Crashes here
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=CodeBuilder-RasConnectionInfo
StackTrace:
at CodeBuilder_RasConnectionInfo.frmRasConnectionInfo.VBConnectionCode(ReportDocument boReportDocument) in C:\Crystal\CodeBuilder-RasConnectionInfo (NET2010 CRVS2010)\CodeBuilder-RasConnectionInfo (NET2010 CRVS2010)\Form1.vb:line 103
at CodeBuilder_RasConnectionInfo.frmRasConnectionInfo.btnLoadReport_Click(Object sender, EventArgs e) in C:\Crystal\CodeBuilder-RasConnectionInfo (NET2010 CRVS2010)\CodeBuilder-RasConnectionInfo (NET2010 CRVS2010)\Form1.vb:line 16
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at CodeBuilder_RasConnectionInfo.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Th
Now, with those assemblies, the version of the crdb_p2ssyb10.dll, should be 13.x. The files for CRVS are in this directory:
C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86
Can you check that the file is there and let me know the version of it?
- Ludek
Unfortunately no it does not work. I get an error and the report is never parsed. A faint hope;
Looking at the version (13.0.9.1312) tells me that we're working with SP 9. SP 14 released last week. Can you please update the install to SP 14? The download links are in the following doc:
Make sure to use the install exe, not the MSI file.
- Ludek
13.0.2000.0 is the assembly version. This does not change from SP to SP, only file version changes. it should be 13.0.14.x
I think we're at a point though, where a phone incident may be warranted. If you have access to the SAP Service Market Place, please create it there. If not, give sales a call:
866-681-3435 or 1-800-677-7271
Worldwide Office Locations | SAP
- Ludek
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.