Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all 3636 articles
Browse latest View live

How list summaryfields?

$
0
0

I'm trying to lookup the summaryfields of existing reports and find out which section and also if it is a percentage summary and which field is being summarized. Is there some sample C# code (I'm using VS 2013) to do this or something someone can share?


Want to disable the parameter prompt in Crystal report Viewer

$
0
0

First Let me tell you. M just a new bee to crystal reports.

 

The problem which i am facing is parameter value prompt which is shown on every refresh of crystal report viewer.

 

I am attaching the screen shot of the promt in this post.

 

Please suggest me a way to disable this as if i will dispatch my product like this. It will be irritating for users to close this prompt each time they use the report.

 

Additional details:

I am using Crystal report for Microsoft visual studio version 13.0.5.891

Adding sortfields in crystal reports 2013

$
0
0

Hi everybody.

 

There is a way to add a sortfield at runtime without loosing the sortfields created at design time?

 

I have a report with a gruop by invoice_id. This sorts a report invoice_id. In the detail section I have the articles. But I want to let the user to choose the sort oder: by article code or by article description. Using this code I can change the sortfields, but it seems to remove the first sort field, wich need to be the invoice_id

 

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

 

Private f_rd_Reporte As ReportDocument

 

        Dim l_fd_SortField As FieldDefinition 'miembro de CrystalDecisions.CrystalReports.Engine

        l_fd_SortField = f_rd_Reporte.Database.Tables("invoices").Fields("article_cod")

            f_rd_Reporte.DataDefinition.SortFields(0).Field = l_fd_SortField

            f_rd_Reporte.DataDefinition.SortFields(0).SortDirection = SortDirection.AscendingOrder

 

Using index of 1 instead of 0 gives me an error of "out of index" (DISP_E_BADINDEX).

 

Need something like an Add method:

f_rd_Reporte.DataDefinition.SortFields.Add(l_fd_SortField, SortDirection.AscendingOrder)




Regards.

Damian.

How to maintain connection to MS Access Database when deploying Application

$
0
0

Hi,

 

My Application uses an MS ACCESS Database that is stored in the Debug Directory.

 

Whilst on the development machine, the crystal reports behave as required.

 

When I deploy the application onto a workstation, the application works fine, but crystal reports is still pointing the location as on the development machine.

 

After copying all the reports to the debug directory, most errors are eliminated however the connection to database is still causing a problem.

 

I have tried this without success:

 

                crConnectionInfo.AllowCustomConnection = true;

                string rptPath = Application.StartupPath;

                crConnectionInfo.DatabaseName = rptPath + @"\POSRSI.mdb";

                crConnectionInfo.UserID = "";

                crConnectionInfo.Password = "";

 

 

How can I programmatically, change the crystal reports connection path?

 

Your help is appreciated.

VB.NET - Crystal Report blank database

$
0
0

I've created a simple report application that view our monthly payment. But when I click the button view. It prompts the Database Login.

Server name: HAS VALUE

Database: NO VALUE

Login ID: HAS VALUE

Password: HAS VALUE

The problem is, the Database field is blank. But I've checked the SQL Database. The database is existing.


Me.Text =""& oCompany.CompanyName &" - Payment Schedule Report"
  
Dim iCon AsNew System.Drawing.Icon(xPath &"\AppIcon1.ico")
  
Me.Icon = iCon
  
Me.WindowState = FormWindowState.Maximized
  ComboBox1
.Text ="Choose Export Format"

  
Dim oConnectInfo AsNew ConnectionInfo
  
Dim oCRTableInfos AsNew TableLogOnInfos
  
Dim oCRTableInfo AsNew TableLogOnInfo
  
Dim oTables As Tables
  
Dim oTable As Table

  cryRpt
=New ReportDocument

  cryRpt
.Load(xPath &"\Rpt\App_BuyerLedger.rpt")

  
With oConnectInfo
  
'MsgBox(oCompany.CompanyDB)
  
.ServerName =""& oCompany.Server &""
  
.DatabaseName = oCompany.CompanyDB
  
.UserID =""& oCompany.DbUserName &""
  
.Password ="p@ssw0rd"
  
.Type = ConnectionInfoType.SQL
  
EndWith

  oTables
= cryRpt.Database.Tables
  
ForEach oTable In oTables
  
'oCRTableInfo = oTable.LogOnInfo
  oCRTableInfo
.ConnectionInfo = oConnectInfo
  oTable
.ApplyLogOnInfo(oCRTableInfo)
  
Next

  oCRTableInfos
.Add(oCRTableInfo)

  oParameter
()

  CrystalReportViewer1
.EnableRefresh =True
  CrystalReportViewer1
.LogOnInfo = oCRTableInfos
  CrystalReportViewer1
.ReportSource = cryRpt
  
'CrystalReportViewer1.Refresh()

Error while export report with subreports to PDF (NET 4.0, C#) - Database Vendor Code: 201

$
0
0

Here is my code

 

bool exportToPdf(int id)        {            var rdoc = new ReportDocument();            ParameterFieldDefinitions parmFields = rdoc.DataDefinition.ParameterFields;            int idx = 0;            try            {                rdoc.Load(HostingEnvironment.MapPath(string.Format("~/App_Data/Reports/{0}", "Rep1.rpt")));                rdoc.SetDatabaseLogon("sa", "SA PASS", "127.0.0.1", "TestTb", true);                 foreach (ParameterFieldDefinition def in parmFields)                {                    if (!def.IsLinked())                    {                                                switch (def.ValueType)                        {                            case FieldValueType.StringField:                                rdoc.SetParameterValue(idx, "");                                break;                            case FieldValueType.NumberField:                                rdoc.SetParameterValue(idx, 0);                                break;                            default:                                rdoc.SetParameterValue(idx, null);                                break;                        }                    }                    idx++;                }                rdoc.SetParameterValue(0, id);                rdoc.ExportToDisk(ExportFormatType.PortableDocFormat, "D:\\report_" + id.ToString() + ".pdf");                return true;            }            catch (Exception ex)            {                Console.Write(ex.Message);                return false;            }        }

On method ExportDoDisk i get error:

Failed to retrieve data from the database. Cannot export report. Error in file Rep1.rpt. Details: Database Vendor Code: 201

(in Polish: pobranie danych z bazy danych nie powiodło się.\rNie można wyeksportować raportu.\n\rBłąd w pliku Rep1.rpt. Pobranie danych z bazy danych nie powiodło się.\nSzczegóły:  [Kod dostawcy bazy danych: 201).

If I preview report in Crystal report designer, there is no problems to generate report.

Crystal lib: 13.0.2000.0

Please help.

No drilldown on column click

$
0
0

Please see screenshot and the mouse icon. Clicking on any column takes us to that row. How do I remove this feature i.e. no click on column.

Report.Close() Hangs in TS Environment Only

$
0
0

We have an enterprise application that includes code to export Crystal Reports to PDF files in the user's own custom folder. This application works fine when running on a regular Windows PC. This same app is deployed to a Windows Server 2008 R2 Datacenter Terminal Server. When the app runs in this environment the report exports to PDF and then when attempting to free the resources by calling ReportDocument.Close() the program hangs.

 

1. Logging was introduced which nailed this down to the execution of ReportDocument.Close(), so it isn't custom code that is failing.

2. Crystal Runtime (13.0.2000) was uninstalled and reinstalled on the TS client without resolution.

3. The original report was quite complex, so this was replaced with a blank report with no connection to a data source, but even this blank report hangs when trying to run ReportDocument.Close()

4. It works on a range of OS's including Windows XP, 8.1, Server 2012, but not on the Terminal Server running Server 2008 R2 or 2008.

 

Any suggestions where to start looking? I've looked up similar posts, but these don't seem to be relevant (eg no custom UFLs)

 

Some further investigation reveals the following:

 

     5. CrystalReportViewer object is also used in the solution and loaded up with 2 reports on 2 tabs. The Temp report copies that the report engine creates are located in the user's AppData folder "c:\Users\UserName\AppData\Local\Temp\34\". When closing down the ReportViewer object, the first report's temp files are all deleted and the ReportViewer hangs while trying to close the last report. This indicates to me that there is NOT a permissions issue with the Temp files.

     6. This is happening with the ReportEngine object AND the ReportViewer object.

     7. This may NOT be Terminal Server (TS) related, but OS related.

 

Running out of ideas...it really looks to be a Crystal Report Engine issue.


Selection formula with more 64K

$
0
0

Hello,

 

sometimes in our program we get selection formula greater than 64K.

 

Is there a way to use this selection formula in crystal reports (variables etc.)?

 

Björn

.NET Viewer Reduced Font after new printer installation

$
0
0

Have been using Crystal Report to create a label without problem until yesterday.  I added a new printer to the desktop.  The .NET viewer reduced the report font by about 75%.  When I send the report to the Zebra printer, the font on the label is also reduced.  How do I fix this problem?

different result when print using crystal report viewer and PrintOutputController.PrintReport

$
0
0

Hi.

I'm using VS 2015

and CR v13,SP16

i am using user defined paper 12 x 14 cm,

 

when print using PrintOutputController.PrintReport the result become smaller than it should be.

when print using CRViewer the result is good and as it should be. but user must set the preferences to user defined paper size and the other printer setting. even though my default setting from control panel has been set.

 

is there anyways to make it programatically sett all of the properties?


datasource for R is setted with another function.

this is my printing code

 

 

                PrintDocument pDoc = new PrintDocument();

                PrinterSettings dPrinterSett = new PrinterSettings();

                PageSettings dPageSetting = new PageSettings();

               

                PrintOptions printOption = R.ReportClientDocument.PrintOutputController.GetPrintOptions();

                printOption.DissociatePageSizeAndPrinterPaperSize = false;

                printOption.PaperSize = CrPaperSizeEnum.crPaperSizeUser;

                printOption.PrinterDuplex = CrPrinterDuplexEnum.crPrinterDuplexSimplex;

 

 

                PrintReportOptions printReportOption = new PrintReportOptions();

                printReportOption.PaperSize = CrPaperSizeEnum.crPaperSizeUser;

                printReportOption.Collated = true;

               

 

 

                R.ReportClientDocument.PrintOutputController.ModifyPrintOptions(printOption);

                R.ReportClientDocument.PrintOutputController.ModifyPrinterName(dPrinterSett.PrinterName);

                R.ReportClientDocument.PrintOutputController.ModifyUserPaperSize((dPageSetting.PaperSize.Height * 1440/100),                                                                                                                         (dPageSetting.PaperSize.Width * 1440/100));

 

 

                if (pDoc.DefaultPageSettings.PaperSize.Height > pDoc.DefaultPageSettings.PaperSize.Width)

                {

                    R.ReportClientDocument.PrintOutputController.ModifyPaperOrientation(CrPaperOrientationEnum.crPaperOrientationPortrait);

                }

                else

                {

                    R.ReportClientDocument.PrintOutputController.ModifyPaperOrientation(CrPaperOrientationEnum.crPaperOrientationLandscape);

                }

               

                R.ReportClientDocument.PrintOutputController.PrintReport(printReportOption);

 

Any Help is appreciated,

Thankyou..

How to create a button/linkbutton/imagebutton in report

$
0
0

I am working in C# windows application in VS2010. I have three columns in my report - ProductName, Quantity, PurchaseDate. Now I want an extra column which on click will show the chart for that particular product. I'm new to crystal report so don't how how to create a button/linkbutton/imagebutton in report. Please advise how can I pass the productname value to show the chart.

Thanks.

Working with CR for VS 13 - Correct Installation Procedure

$
0
0

Hello all,

 

I intend to work with Crystal Reports for VS 13 on a win7 64-bit os and the admin sent the necessary installation files (exe-file, clickonce-file, mergemodules-file, 32-bit and 64-bit-install-file) to me.

My question: Do I still have to install VS or is it included somehow (in form of plugins e.g.) in one of the installation files?

 

If not, what is the correct procedure for installation?

 

Sorry, but I am a beginner to this topic.

 

Kind regards and thanks in advance for your help.

 

 

Eberhard

Step by step instructions to deploy a VS2013 application

$
0
0

Can Someone point me to a document that can explain what I need to do to deploy a program developed in VS2013 that includes a crystal report?

 

Is it CrystalReports10_NET_EmbeddedServerInstall.msi?  What are key codes?

print button on asp.net crytal report viewer exports the report in .pdf format

$
0
0

print button on asp.net crytal report viewer exports the report in .pdf format instead of showing the printers window.

 

I am using VS2010 with  Version=13.0.2000.0 of crystal report


GroupSortFields in crystal reports 2013

$
0
0

Hi everybody.

 

I used to change the group sorting by code in VB6 and cystal reports XI using the GroupSortFields collection in this way:

Private Sub AplicarOrdenamientoGrupo(ByRef f_rep_Reporte  As craxdrt.Report)

 

    Dim l_i_Ordenamiento As Integer

    Dim l_sfd_SummFieldDef As craxdrt.SummaryFieldDefinition

 

    For l_i_Ordenamiento = 1 To f_i_OrdenamientoGrupo

 

        Set l_sfd_SummFieldDef = f_rep_Reporte.SummaryFields.Item(ObtenerIndiceSummField(f_s_OrdenamientosGrupo(l_i_Ordenamiento).Agrupador, f_s_OrdenamientosGrupo(l_i_Ordenamiento).Columna, f_s_OrdenamientosGrupo(l_i_Ordenamiento).Operacion))

        f_rep_Reporte.GroupSortFields.Add l_sfd_SummFieldDef, f_s_OrdenamientosGrupo(l_i_Ordenamiento).Direccion

        Set l_sfd_SummFieldDef = Nothing

 

    Next l_i_Ordenamiento

 

End Sub

 

ObtenerIndiceSummField: is a function wich returns the index of a summaryfield in the summaryfields collection

 

Now I'm using VS 2012 and SAP crystal reports 2013 and I can't find something similar. How can I achieve this behaviour? I used to let the user to select the sort order.

 

Regards.

Damian.

Database Logon Failed - only on one of two identical servers

$
0
0

I have a Windows application (not web-based) that is used to run and export Crystal report files to PDF.   The application runs fine in both my dev and test environments locally, and it is also running smoothly on my client's production environment.  The client is not trying to set up a fresh Test environment, and we are encountering the "Database logon failed." error.  I don't have direct access to the servers, but for everything I can think to check, everything appears to be identical in the two environments.  I'd welcome any suggestions on what to try, as I've exhausted the things I can think to check to find the differences.

 

Development:

Application written in VS2010, with runtimes installed with the proper install package, not just running the msi, per instructions.   It is compiled with the platform set to "Any CPU".

 

The Crystal rpt's in use are older Crystal XI R2 files that were inherited from an older system.  They point to a specific ODBC name, but the database that that ODBC is set to changes at run-time (because we could be running the same report against one of a number of db's).  I found during development that I had to modify the report connection's "Use DSN Default Properties" setting to "true", but they've otherwise seemed to run smoothly up until now.

 

Deployment Environment:

Both the working and not-working environments are running the application on a Windows 2012 R2 server (64-bit) and hitting a SQL Server 2008 R2 database.  The Crystal 64-bit runtimes are installed.  Both ODBC's are pointing to a SQL Server driver version 6.03.9600.17415.  They were set up in the 32-bit ODBC manager, but show as 32/64-bit so I presume there isn't a clash there (or there isn't in production, anyway).

 

The basic code used to generate the report:

 

reportDocument.Load(rptFilePath);

reportDocument.SetDatabaseLogon(strUser, strPwd);

CrystalDecisions.CrystalReports.Engine.Tables tables = reportDocument.Database.Tables;

 

connectionInfo.ServerName = "MyODBCName";

connectionInfo.DatabaseName = strDB;

connectionInfo.UserID = strUser;

connectionInfo.Password = strPwd;

 

foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)

{

    TableLogOnInfo tableLogonInfo = table.LogOnInfo;

    tableLogonInfo.ConnectionInfo = connectionInfo;

}

 

reportDocument.SetParameterValue(0, myParameterValue);

reportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, pdfFilePath);

Not able to open .rpt file in my VS2010 SP1

$
0
0

Hello,

 

I am completely new to Reports. I have one project with me which contains ".rpt" file, but while opening the same in my  VS2010 SP1, it is not opening proper report file.

a.jpg

 

Please help me out.

OS : Windows 7 SP1 - 32 bit

VS : 2010 SP1 - 32 bit

Invalid field number returned after changing grouping/sorting through SDK

$
0
0

We have a Crystal Report version 2008 with 2 Group fields defined and 3 other Sort fields.  Our application uses the SDK to overwrite the grouping and sorting in the report.    The application will remove all sort and group fields (using ReportAppServer.Controllers.SortController.Remove) then add back in any sorts or groups that the user wants to use.

 

The operations to remove and add the sort and group fields works correctly.  However, when CrystalReports.Engine.Table.ApplyLogOnInfo is called later, it fails with Invalid Field Number.  This does work if the first field added back in was one of the group fields; if a different field is added first, then I receive this error.

 

This code worked correctly when running version 12 of the CrystalReports.Engine; it now fails since going to version 13.  I attempted to apply the most recent service pack and am still receiving the error, but when calling a different API.

 

Are there any known issues with overriding the report grouping, particularly with version 13 of the runtime engine?

 

Thank you for any insight.

Crystal Report on .Net 4.0 Issue

$
0
0

Hi everyone,

 

I'm new here so please bear with me.

I'm developing an application in visual studio 2015 that requires to produce a report.
I'm using SAP Crystal Report but I'm having a problem printing if my target .net is 4.0.

 

Note:

I tried using .net 3.5 and it's working.

When I switched to ,net 4.0, I encountered a problem.

 

Can someone help me fix this problem?

 

Thanks!

Viewing all 3636 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>