Error on reportdocument.SetDataSource

Hello. I am working in VS 2010 environment. I am trying to open a report based off of data set. But looks like I am doing something wrong, it's throwing an exception with 'Invalid report file path'. Can you tell me what I need to do load from a dataset correctly? I am crystal reports for VS2010. Thanks.
Here's my code:
    Private Sub loadCrystalReport() Handles CrystalReportViewer1.Load
        Dim dsData As New Data.DataSet
        Dim sqlcmm As SqlClient.SqlCommand
        Dim daAdapter As New SqlClient.SqlDataAdapter
        Dim cnn As New SqlClient.SqlConnection
        cnn.ConnectionString = " server=bbsql5;" & _
            "uid=masif;password=testpass;database=casemang"
        cnn.Open()
        If cnn.State = ConnectionState.Open Then
            sqlcmm = New SqlClient.SqlCommand("select * from dailylog", cnn)
            daAdapter.SelectCommand = sqlcmm
            daAdapter.Fill(dsData, "DailyLog")
            If dsData.Tables(0).Rows.Count > 0 Then
                reptDoc.SetDataSource(dsData)
                CrystalReportViewer1.ReportSource = reptDoc
            End If
        End If
    End Sub

Not sure why it's not giving me the results from the select query instead of the whole report then. Here's my code.
reptDoc is the the document. I am trying to load the report DailyLog.rpt with the data set from my query . But right now it loads everything.
    Private Sub loadCrystalReport() Handles CrystalReportViewer1.Load
        Dim dsData As New Data.DataSet
        Dim sqlcmm As SqlClient.SqlCommand
        Dim daAdapter As New SqlClient.SqlDataAdapter
        Dim cnn As New SqlClient.SqlConnection
        cnn.ConnectionString = " server=bbsql5;" & _
            "uid=masif;password=testpass;database=casemang"
        cnn.Open()
        If cnn.State = ConnectionState.Open Then
            sqlcmm = New SqlClient.SqlCommand("select * from dailylog where rundate >='8/18/2011'", cnn)
            daAdapter.SelectCommand = sqlcmm
            daAdapter.Fill(dsData)
            If dsData.Tables(0).Rows.Count > 0 Then
                reptDoc.Load("l:\reports\ecase\dailylog.rpt")
                reptDoc.SetDataSource(dsData)
                 CrystalReportViewer1.ReportSource = reptDoc
                CrystalReportViewer1.RefreshReport()
            End If
            sqlcmm.Dispose()
        End If
    End Sub

Similar Messages

  • ReportDocument.SetDataSource(DataTable dataTable) OutOfMemoryException

    When a customer attempts to display a certain report with a calendar year of data, they get the OutOfMemoryException.  Apparently they can successfully display any other report before or after.  This is .NET 2.0, Crystal Reports 2008 on a desktop client querying a database server.
    Exception: Exception of type 'System.OutOfMemoryException' was thrown. (Type: System.OutOfMemoryException; Source: System.Data)
    STACK TRACE (Top Level):
       at System.Data.Common.Int32Storage.SetCapacity(Int32 capacity)
       at System.Data.RecordManager.set_RecordCapacity(Int32 value)
       at System.Data.RecordManager.GrowRecordCapacity()
       at System.Data.RecordManager.NewRecordBase()
       at System.Data.RecordManager.CopyRecord(DataTable src, Int32 record, Int32 copy)
       at System.Data.DataTable.CopyRow(DataTable table, DataRow row)
       at System.Data.DataTable.Copy()
       at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)
    Can any configuration be set to provide more memory?  Is there a way to tell in advance if a dataset or datatable is too large?

    Doh... Sorry should have noticed that you are using a DS
    Yes, in CR 9 it was lighter, after CR 10 they rewrote/updated the DB drivers as well as other new features so CR consumes more memory space.
    DS's are good for about 5K rows, depends on the amount of data in the row of course, anything more and you will always get an out of memory error. Due to limitations in the way Windows handles DS's, now one can access the DS directly so when you use it CR needs to copy the DS it our memory space thus doubling the amount of memory required.
    If you are going to allow them to use large data sets then either create another report that hits the DB directly or convert the existing report using RAS using the Replace_Connection method ( search here for sample code ) and set location to the DB using OLE dB Provider.
    Thanks
    Don

  • Attempted to read or write protected memory error on reportdocument.load

    Reportdocument.load causes "System.AccessViolationException: Attempted to read or write protected memory" error.
    The error is not consistent. Sometimes a report will print. Sometimes a report will error.
    I am at a loss as to what to try.
    I have uninstall the app, reinstalled the app, uninstall and reinstalled .NET frameworks, Visual C++ runtime, etc.,
    reworked the code to try to capture the error. Nothing helps. Application crashes with Unhandled exception.
    Attempted to read or write to protected memory.
    Has anyone been able to resolve this issue?

    Hi Mary,
    What happens if you set your project to use 4.0 framework?
    Anything else in the Event Viewer to show an access violation?
    Have you tried updating the printer driver to one that is supported in the Framework? I find most legacy printers tend to use the old DEVMODE structure and not the Framework. Try using the printer off the Window CD rather than the Manufacturers driver.
    Is your app doing "Report Bursting"? In other words sending multiple reports one right after the other with no time between?
    Are you using any legacy UFL's? Try renaming u2lcom.dll if you are not using them. If you do you'll get an error in formula.
    Are you using try/catch in your code around each CR API? It may catch something more for you also.
    AND, can you try a C# project, some thing very simple also. I've of issues in VS VB that do not show up in other dev languages. Neither Microsoft or SAP can figure out what the cause is.
    Thank you
    Don
    Edited by: Don Williams on Feb 11, 2011 2:34 PM

  • Failed to load database information. Error in File temp_

    Our environment:
    Windows Server 2012 R2 Data-center Edition 64 bit
    Visual Studio Pro 2013 Version 12.0.3.30110.00 Update 1
    .Net 4.5.51641
    Crystal Reports for VS 2013 V13.0.9.1312
    Oracle ODAC 11.2.0
    We created a winform application to generate a form letter report that runs fine within the IDE. When we build the the exe and copy it from the project folder to a folder on the C:\drive of this same pc and try to execute it we get these error messages (partial list);
    CrystalDecisions.CrystalReports.Engine.DataSourceException: Failed to load database information.
    Error in File temp_d55286fc-26ee-4216-9062-3e32380313ab {B640FD39-66AC-4B6E-995D-7218BB48A992}.rpt:
    Failed to load database information. ---> System.Runtime.InteropServices.COMException: Failed to load database information.
    Error in File temp_d55286fc-26ee-4216-9062-3e32380313ab {B640FD39-66AC-4B6E-995D-7218BB48A992}.rpt:
    Failed to load database information.
       at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault)
       at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
       --- End of inner exception stack trace ---
       at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)
       at cr3Test.Form1.Form1_Load(Object sender, EventArgs e)
    Here is the app:
    Imports System.Data.OleDb
    Imports System.Data
    Imports System
    Imports System.Windows.Forms
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Public Class Form1
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
            Dim crReportDocument As New CrystalReport3()
            Dim DataSet1 As DataSet
            Dim adoOleDbConnection As OleDbConnection
            Dim adoOleDbDataAdapter As OleDbDataAdapter
            Dim connectionString As String = ""
            connectionString = "Provider=OraOLEDB.Oracle;"
            connectionString += "Data Source=ourdb;"
            connectionString += "User ID=ouruserid;Password=ourpsw"
            adoOleDbConnection = New OleDbConnection(connectionString)
            Dim sqlString As String = "select * from TEMP_FRI_LETTERS"
            adoOleDbDataAdapter = New OleDbDataAdapter(sqlString, adoOleDbConnection)
            DataSet1 = New DataSet()
            adoOleDbDataAdapter.Fill(DataSet1, "TEMP_FRI_LETTERS")
            'Dim xmlPath As String = "C:\Temp\test.xml" ' use these two statment s to verify dataset works
            'DataSet1.WriteXml(xmlPath, XmlWriteMode.WriteSchema)
            crReportDocument.SetDataSource(DataSet1)
            crReportDocument.PrintOptions.PrinterName = "HP_LaserJet_4350_PCL_5e_Info_Tech"
            crReportDocument.Refresh()
            crReportDocument.PrintToPrinter(1, False, 0, 0)
            DataSet1.Dispose()
            adoOleDbDataAdapter.Dispose()
            adoOleDbConnection.Close()
            adoOleDbConnection.Dispose()
            crReportDocument.Dispose()
            Me.Close()
        End Sub
    End Class
    Here is the app.config:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup useLegacyV2RuntimeActivationPolicy="true">
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
        </startup>
        <system.windows.forms jitDebugging="true" />
    </configuration>
    We have the CPU set to x86 as we are ultimately trying to generate a 32 bit app for XP and Win 7. We only installed the 32 bit run time on this pc because we have no intention of going to 64 bit apps on the clients. Are there additional dlls or something that has to be installed in the same folder as the exe on this development machine.
    Bruce

    Looking at the AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_myprograminfo led us to the last dll loaded being:
    LoadedModule[211]=C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\crdb_adoplus_res_en.dll
    State[0].Key=Transport.DoneStage1
    State[0].Value=1
    FriendlyEventName=Stopped working
    Scanning the community for "crdb_adoplus_res_en.dll" we got a hot on this issue again:
    Failed to load database information. Error in File temp_
    From the above we found this:
    1. the app.exe.config is all in one package which cannot be separated with the EXE file.
    2. the supporting component such as dll files, app.exe.config etc CANNOT be combined into the EXE file
    Adding the cr3Test.exe.config to the same folder as the cr3Test.exe RESOLVED the problem on Win 7. It also RESOLVED the problem on Server 2012 R2.
    We still need to test on Server 2008 R2 but we are hopeful when that time comes.
    Thanks.
    Bruce

  • Report.SetDataSource throws exception upgrading from VS2005 to Xtal 2008 VA

    <p>
    Using Visual Studio 2005 with Crystal 2008 Visual Advantage on Vista w/ SP1. Visual Studio has all service packs applied as well.
    </p><p>
    I am trying to evaluate the Crystal 2008 Visual Advantage product.
    </p><p>
    Here's the use case: I get an IEnumerable of a certain object at run time, then pass this list of objects to SetDataSource(IEnumerable).  <b>This code ran fine under the version of crystal included with VS2005, but after installing the product and running the Crystal 2008 VA conversion wizard on this project, SetDataSource now crashes and burns</b> with the following:
    </p><p>
    System.Reflection.TargetParameterCountException  {"Parameter Count Mismatch"}
    </p><p>
    The exception is clearly in the Crystal runtime, as the stack trace reveals (see below).  I should also mention that the database verifies, and that I have been able to relocate the database with the databse locator. No luck. Clean and rebuild, No luck. Anybody got any suggestions?
    </p><p>
    Stack Trace:
    </p><p>
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
    </p><p>
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) </p><p>
       at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) </p><p>
       at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.PopulateTableFromObject(Object obj, Boolean flattenCurrentObject, Int32 currentLevel, Int32 maximumLevels, String columnNamePrefix, DataTable table, ArrayList rowset) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.PopulateTableFromObjectCollection(IEnumerable collection, DataTable table) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.BuildTableFromEnumerable(IEnumerable collection, Type dataClassType, String tableName) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.EnumerableToDataSet(IEnumerable collection)
       at CrystalDecisions.CrystalReports.Engine.Table.WrapAndCacheDotNetObject(Object val, Type type, ISCRAdoNetDataSet& crAdoNetDataSet) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) </p><p>
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(IEnumerable enumerable)
    </p><p>

    I have compiled and run these tutorials with no problems.
    <br>
    I must reiterate that I don't see how these tutorials could possibly be pertinent to the problem.
    <br>
    I can set my object collection to be a datasource for other .NET data aware controls such as datagrids and so forth, and to Crystal Reports .rpts compiled with the VS2005 and VS2008 supplied product. I <b><i>cannot</b></i> set my object collection to be a datasource for the stand-alone VA product.
    <br>
    Your XII runtime is crashing with an "invalid number of parameters" exception.  This is a serious programming error, and it cannot be caused by my code -- <b><i>my</b></i> code cannot tell <b><i>your</b></i> runtime how many parms to call a .NET method with.

  • CrystalDecisions.CrystalReports.Engine.InternalException Error

    Post Author: crash75k
    CA Forum: .NET
    I am getting the following error when generating and printing a crystal report from my .net project.  It's rather intermitant, that is i know the data isn't the problem as have re-run a record which caused the error and it printed successfully.  Little bit confused as to actually what is causing the problem?  One thing i did try is moving to a different printer which helped, that is the problem happens less frequently but still occurs. Any ideas Ta  CrystalDecisions.CrystalReports.Engine.InternalException: Error in File F:\DOCUME1\ADMINI1.RIM\LOCALS1\Temp\Omgeo Import Print {7AE4245E-AC71-47F2-BEDB-C76014B48B83}.rpt:The request could not be submitted for background processing. ---> System.Runtime.InteropServices.COMException (0x800002AD): Error in File F:\DOCUME1\ADMINI1.RIM\LOCALS1\Temp\Omgeo Import Print {7AE4245E-AC71-47F2-BEDB-C76014B48B83}.rpt:The request could not be submitted for background processing.   at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault)   at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)   --- End of inner exception stack trace ---   at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)   at OmgeoImporter.CrystalComponent.setDataSetTable(DataTable dsp)   at OmgeoImporter.Importer.printCrystal(DataSet txtds)

    Post Author: MJ@BOBJ
    CA Forum: .NET
    Intermittent issues can be very difficult to troubleshoot and solve.  This particular error typically occurs when trying to process data (not necessarily a particular row of data), but it could be related to other things (as you noticed when changing printer drivers).  I would make sure you have the latest patch for the version of CR you are using as there have been fixes done for this error.
    Otherwise, I recommend working with the BOBJ support team to help troubleshoot the issue as there are a lot of things that can be investigated to find the root of the issue.

  • How to troubleshoot Crystal Errors

    Hi,
    I am hoping someone can help me.  We print Crystal Reports through a third part application.  We have Crystal 2008 developers edition installed.  Things will be fine and after about the 10th job we receive the following error: 
    Exception:CrystalDecisions.Shared.CrystalReportsException
    Message:Load report failed.
    Source:CrystalDecisions.CrystalReports.Engine
    Target:Void EnsureDocumentIsOpened()
    Stack trace:   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
       at Accellos.Integration.IntegrationServer.InitReport(String reportId, String reportFileName, PlatformDataProviderConnectionInfo conInfo, IEnumerable`1 tables, IEnumerable`1 parameters)
    Inner Exception:System.Runtime.InteropServices.COMException
    Message:Unknown error 0x80040200
    Source:sacommlayer.dll
    Target:Void Open(System.Object ByRef, Int32)
    Stack trace:   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
       at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
       at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
    Edited by: KarenBrookes on Jul 4, 2010 5:31 AM

    Hi Ludek,
    I want to thank you very much for your replies.
    Please note I have been working with the developer on this and we have not been able to determine the cause.
    It also is worth noting that this is not reproducable on their TEST BOX with the same code.
    On their Production Box it works, then stops, we re-submit and it works again.  I dont know if you are able to review what I have pasted here but here is a snippet of the code.  We have been troubleshooting this for 3 weeks now so any thing you can advice would help.  Also, does SAP have a Pay per Use support?  If they do,  are the support reps at a level that they could help us to debug what is going wrong?
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Data;
    using System.Globalization;
    using System.IO;
    using Accellos.Integration.CrystalReports;
    using Accellos.Integration.Utils;
    using Accellos.Platform.Data.DataProviders;
    using Accellos.Platform.ExternalReports.Data;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    namespace Accellos.Integration
                    public class IntegrationServer
                                    #region private InitReport
                                    private static void InitReport(ReportDocument reportDocument, PlatformDataProviderConnectionInfo conInfo,
                                                                                    IEnumerable<DataTable> tables, IEnumerable<KeyValuePair<string, object>> parameters)
                                                    #region Set connection
                                                    if (conInfo != null)
                                                                    foreach (Table table in reportDocument.Database.Tables)
                                                                                    TableLogOnInfo logOnInfo = table.LogOnInfo;
                                                                                    logOnInfo.ConnectionInfo.ServerName = conInfo.ServerName;
                                                                                    logOnInfo.ConnectionInfo.DatabaseName = conInfo.DatabaseName;
                                                                                    logOnInfo.ConnectionInfo.IntegratedSecurity = conInfo.IntegratedSecurity;
                                                                                    logOnInfo.ConnectionInfo.UserID = conInfo.UserId;
                                                                                    logOnInfo.ConnectionInfo.Password = conInfo.UserPassword;
                                                                                    table.ApplyLogOnInfo(logOnInfo);
                                                    #endregion
                                                    #region Set data tables
                                                    DataSet dataSet = new DataSet("cr") {Locale = CultureInfo.InvariantCulture};
                                                    foreach (DataTable table in tables)
                                                                    dataSet.Tables.Add(table);
                                                    if (dataSet.Tables.Count > 0)
                                                                    reportDocument.SetDataSource(dataSet);
                                                    reportDocument.Refresh();
                                                    #endregion
                                                    #region Set data parameters
                                                    Dictionary<string, object> prms = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
                                                    foreach (KeyValuePair<string, object> pair in parameters)
                                                                    prms.Add(pair.Key, pair.Value);
                                                    foreach (ParameterField field in reportDocument.ParameterFields)
                                                                    if (reportDocument.DataDefinition.ParameterFields[field.Name].IsLinked())
                                                                                    continue;
                                                                    if (prms.ContainsKey(field.Name))
                                                                                    reportDocument.SetParameterValue(field.Name, prms[field.Name]);
                                                    #endregion
                                    #endregion
                                    #region PrintReport
                                    public void PrintReport(string reportId, string reportFileName, PlatformDataProviderConnectionInfo conInfo,
                                                            Collection<DataTable> tables, Dictionary<string, object> parameters,
                                                            ExternalReportPrintInfo printInfo)
                                                    #region Check parameters
                                                    if (reportId == null)
                                                                    throw new ArgumentNullException("reportId");
                                                    reportId = reportId.Trim();
                                                    if (reportId.Length == 0)
                                                                    throw new ArgumentException("Can not be null or empty.", "reportId");
                                                    if (reportFileName == null)
                                                                    throw new ArgumentNullException("reportFileName");
                                                    reportFileName = reportFileName.Trim();
                                                    if (reportFileName.Length == 0)
                                                                    throw new ArgumentException("Can not be null or empty.", "reportFileName");
                                                    if (!File.Exists(reportFileName))
                                                                    throw new FileNotFoundException("File [" + reportFileName + "] does not exist for report [" + reportId +
                                                                                    "]. Crystal engine can not be initialized.");
                                                    #endregion
                                                    using (ReportDocument reportDocument = new ReportDocument())
                                                                    #region Load document
                                                                    try
                                                                                    reportDocument.Load(reportFileName);
                                                                    catch (Exception e)
                                                                                    CustomFileLog log = new CustomFileLog(IntegrationService.IntegrationServiceErrorsLog);
                                                                                    log.Write("Can not load crystal report file.");
                                                                                    log.Write(e);
                                                                                    throw new Exception("Report [" + reportId + "]. Crystal Report Engine: " + e.Message
                                                                                    + Environment.NewLine + "Please, check Crystal Report Version or Report template file.");
                                                                    #endregion
                                                                    InitReport(reportDocument, conInfo, tables, parameters);
                                                                    reportDocument.PrintOptions.PrinterName = printInfo.PrinterName;
                                                                    for (int i = 0; i < printInfo.NCopies; i++)
                                                                                    reportDocument.PrintToPrinter(1, printInfo.Collated, printInfo.StartPage, printInfo.EndPage);
                                    #endregion

  • SetDataSource causes code reentrance (bug)

    Post Author: willi
    CA Forum: .NET
    Using CR.Net 1.1 SP2 (VS 2003 SP1), WinXP Prof/SP2Problem:Calling the SetDataSource method of a ReportDocument object causes code reentrance, probably due to processing the message queue. This can cause unexpected problems. The callstack in the following example shows that a Timer's Tick event occurs while calling the SetDataSource method:CSSReports.Form1.Timer1_TickSystem.Windows.Forms.Timer.OnTick   System.Windows.Forms.Timer.DebuggableCallback   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load   CrystalDecisions.CrystalReports.Engine.ReportClass.Load   CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource   This must not happen! Other events could occur, too. Is there a hotfix for this problem? This is a serious issue because while loading one report I was able to select a MenuItem and open a 2nd report before loading the 1st report finished (not a multithreaded application). This behavior can just as many problems as explicitly calling Application.Doevents. In short: SetDataSource must not process any messages in the mesage queue.

    It looks like the error only occurred when I used JUnit to test it - which was probably due to something I did.  When I managed to get the code working, the problem was that the newly added table got referenced by the next itteration. I solved it by using a HashMap.
    Map<String, ResultSet> results = new HashMap<String, ResultSet>();
    Tables tables = reportClientDoc.getDatabaseController().getDatabase().getTables();
    for (int i = 0; i < tables.size(); i++) {
        String tableAlias = reportClientDoc.getDatabaseController().getDatabase().getTables().getTable(i).getAlias();
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con = DriverManager.getConnection("jdbc:odbc:CSV_DSN");
        Statement stmt = con.createStatement();
        String query = "select * from " + tables.getTable(i).getName();
        ResultSet rs = stmt.executeQuery(query);
        results.put(tableAlias, rs);
    final Enumeration<String> aliasEnumeration = Collections.enumeration(results.keySet());
    while (aliasEnumeration.hasMoreElements()) {
        String oldAlias = aliasEnumeration.nextElement();
        ResultSet rs = results.get(oldAlias);
        reportClientDoc.getDatabaseController().setDataSource(rs, oldAlias, oldAlias + "_rs");

  • Errors when viewing data with Crystal Report Viewer.

    we receive the following errors when we try to merge a crystal report with data, we are using a crystal  report viewer to display the report.
    Can someone help us with where we might be going wrong?
    Thanks
    Rajesh
    General Information
    Additional Info:
    ExceptionManager.MachineName: CCS104
    ExceptionManager.TimeStamp: 02/10/2008 12:40:31
    ExceptionManager.FullName: Congestion.Framework.ExceptionManagement, Version=33.36.0.0, Culture=neutral, PublicKeyToken=null
    ExceptionManager.AppDomainName: /LM/W3SVC/1/ROOT/BackOfficeTR4-1-128674174088125000
    ExceptionManager.WindowsIdentity: NT AUTHORITY\SYSTEM
    Renewal charges Statement Id : 37171
    Unknown Database Connector Error
    Error in File C:\WINNT\TEMP\{AE9A7C1D-F11A-41CC-B2F7-BC1062DC3A5B}.rpt:
    Unknown Database Connector Error
    Stack Trace :    at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.  (Object 
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)
       at Congestion.Core.PresentationTier.BackOffice.WF_NewReport_P.DownloadPDFStatement(Int64 lngCanId, Int64 lngFasId, String strChargeType)
       at Congestion.Core.PresentationTier.BackOffice.WF_NewReport_P.Page_Load(Object sender, EventArgs e)
    Source : CrystalDecisions.ReportAppServer.DataSetConversion

    Hi,
    Its a best practice to use the code given below in the unload event of the page or the code can also be written in a button press event so that the disposing is ensured manually(If sessions are in use).
    boReportDocument.Close();
    boReportDocument.Dispose();
    GC.Collect();
    Note: boReportDocument is the object of ReportDocument.
    This code disposes the report object after using it.
    Check the issue with [filemon|http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx] utility.
    Amit

  • Problem with SetDataSource and SubReports

    Post Author: soxi
    CA Forum: Data Connectivity and SQL
    Hello,
    I have an application wich displays report with a dropdowlist.When I display a report with  subreports, this works once but after I have an error.
    I fill a dataset with several table.One table for the main report et two for the two subreports.
    da = new OracleDataAdapter("request1", cn);da.Fill(ds, "tableMain");da.SelectCommand.CommandText = "request2";da.Fill(ds, "tableSubReport1");da.SelectCommand.CommandText = "request3";da.Fill(ds, "tableSubReport2");cn.Close();
    After I bound my dataset with my report et subreports:
    1 for (int i = 0; i < ds.Tables.Count; i++)2 {3   if (i == 0)4     this.CRSource.ReportDocument.SetDataSource(ds.Tables&#91;i&#93;);5  else 6   {7           this.CRSource.ReportDocument.Subreports&#91;i - 1&#93;.SetDataSource (ds.Tables&#91;i&#93;);8   }this.CRSource.EnableCaching = true;this.CRViewer.ReportSource = this.CRSource;
    Error Message:My error message throws at the line 7:"System.Runtime.InteropServices.COMException: Le canal de communication n'a pas été créé.",(It is a french error, In english I think it was:"The channel of communication has not been established").
    When I enclose this line 7 with a "try" and a "catch" empty, a page come back:This page asks me this information:Server name,Database name, user name and password.
    Ask:I don't understand this error.I have search in all forums.Have you an idea of this problem?

    Thanks i got the audio problem fixed.
    When I open up final cut it says some of the media has been disconnected but it then says I can't reconnect it or something like that, I don't know if that effects the transitions. I split up a lot of footage and rearranged it and for one of the places where it flashes a clip it shows one of the pieces of footage that I had deleted because it had a glitch and the other places I noticed it it had random clips from throughout the project, like a flash of an interview that happens way later in the film. So it is random clips that are in the film and even clips that I deleted.

  • VS2008 Linq To SQL Dataset SetDatasource

    Here is the problem and I have found no helpful solution. I am using LinqToSQL to pull the data into a dataset. No problems there. The problem comes when assigning that dataset as the datasource for a Crystal Report. When I run the report it says
    System.NotSupportedException was unhandled
      Message="DataSet does not support System.Nullable<>."
      Source="System.Data"
      StackTrace:
           at System.Data.DataColumn..ctor(String columnName, Type dataType, String expr, MappingType type)
           at System.Data.DataColumn..ctor(String columnName, Type dataType)
           at System.Data.DataColumnCollection.Add(String columnName, Type type)
           at CrystalDecisions.CrystalReports.Engine.Table.BuildTableFromEnumerable(IEnumerable collection, Type dataClassType, String tableName)
           at CrystalDecisions.CrystalReports.Engine.Table.EnumerableToDataSet(IEnumerable collection)
           at CrystalDecisions.CrystalReports.Engine.Table.WrapAndCacheDotNetObject(Object val, Type type, IntPtr& pUnkDataSet, IntPtr& pDotNetDelegate)
           at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(IEnumerable enumerable)
           at Pack_Win.frmReports.crystalReportViewer1_Load(Object sender, EventArgs e) in C:\VersioningVS2008\Pack-Win\Pack-Win\Pack-Win\frmReports.cs:line 32
           at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
           at CrystalDecisions.Windows.Forms.CrystalReportViewer.OnCreateControl()
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl()
           at System.Windows.Forms.Control.WmShowWindow(Message& m)
           at System.Windows.Forms.Control.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)
      InnerException:
    I have seen references to defaulting the nullables but can't find sample code. Can anyone help with this?

    I have the dataset populated using the code below and was able to create a working report.
    DataSet fds = new DataSet();
                ReportDocument rd = new ReportDocument();
                if (currfunc == "CustList")
                    rd.Load(@".\Reports\CustList.rpt");
                    PackWinDataSet.PACK_CUSTOMERDataTable repdt = new PackWinDataSet.PACK_CUSTOMERDataTable();
                    PackWinDataSetTableAdapters.PACK_CUSTOMERTableAdapter repdat = new Pack_Win._Pack_WinDataSetTableAdapters.PACK_CUSTOMERTableAdapter();
                    repdat.Fill(repdt);
                    fds.Tables.Add(repdt);
                    rd.SetDataSource(fds);

  • Sql:setDataSource - "java.sql.SQLException: No suitable driver" Again :(

    Hi everyone,
    I have the following jsp page:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <sql:setDataSource driver="jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;user=sa;password=sa" var="dSource"/>
    <sql:query var="contacts" dataSource="${dSource}">
    SELECT TOP 10 FROM Person.Contact
    </sql:query>
    <table border="1">
    <c:forEach var="row" items="${contacts.rows}">
    <tr>
    <th>
    Contact ID
    </th>
    <th>
    First Name
    </th>
    <th>
    Middle Name
    </th>
    <th>
    Last Name
    </th>
    </tr>
    <tr>
    <td>
    <c:out value="${row.ContactID}" />
    </td>
    <td>
    <c:out value="${row.FirstName}" />
    </td>
    <td>
    <c:out value="${row.MiddleName}" />
    </td>
    <td>
    <c:out value="${row.LastName}" />
    </td>
    </tr>
    </c:forEach>
    </table>
    </body>
    </html>
    When I run it, got the following exception:
    exception
    org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 20
    17: </head>
    18: <body>
    19: <sql:setDataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" dataSource="jdbc:microsoft:sqlserver://localhost:1433;databaseName=AdventureWorks;" user="sa" password="sa" var="dSource"/>
    20: <sql:query var="contacts" dataSource="${dSource}">
    21:           SELECT TOP 10 FROM Person.Contact
    22: </sql:query>
    23:
    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    root cause
    javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:102)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    But when I write a servlet with doGet as below:
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet MyServlet</title>");
    out.println("</head>");
    out.println("<body>");
    String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;user=sa;password=sa";
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    con = DriverManager.getConnection(connectionUrl);
    String SQL = "SELECT TOP 10 * FROM Person.Contact";
    stmt = con.createStatement();
    rs = stmt.executeQuery(SQL);
    while (rs.next()) {
    out.println(rs.getString(4) +" "+ rs.getString(6) + "<br/>");
    catch (Exception e) {
    e.printStackTrace();
    } finally {
    if (rs != null) {
    try {
    rs.close();
    } catch (Exception e) {
    if (stmt != null) {
    try {
    stmt.close();
    } catch (Exception e) {
    if (con != null) {
    try {
    con.close();
    } catch (Exception e) {
    out.println("</body>");
    out.println("</html>");
    } finally {
    out.close();
    Everything is ok.
    I'm using Netbean 6.7.1, Tomcat 6.0.18, JDK 5.0. And I already tried to put the sqljdbc.jar to the lib folder of Tomcat or the JAVA_HOME\jre\lib\ext but no luck.
    Please give advice.

    The issue is with your usage of the sql:setDataSource tag. You should either specify a driver and url attributes, or* a datasource attribute.
    The datasource attribute follows the syntax: url[,[driver][,[user][,password]]] (ref Section 10.1.1 of the JSTL1.1 spec)
    You were using the datasource attribute, but not including the driver within it.
    So one of the following should work:
    <sql:setDataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=AdventureWorks;" user="sa" password="sa" var="dSource"/>or
    <sql:setDataSource dataSource="jdbc:microsoft:sqlserver://localhost:1433;databaseName=AdventureWorks;,com.microsoft.sqlserver.jdbc.SQLServerDriver,sa,sa" var="dSource"/>----------
    As an aside your code example doesn't seem to match with the error message:
    In your code:
    <sql:setDataSource driver="jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks;user=sa;password=sa" var="dSource"/>From the error message:
    <sql:setDataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" dataSource="jdbc:microsoft:sqlserver://localhost:1433;databaseName=AdventureWorks;" user="sa" password="sa" var="dSource"/>These two are not the same. Not sure if that is caused by a forum bug, or you trying various things. But the fact they don't match doesn't help :-).
    cheers,
    evnafets

  • SubreportClientDocument.DatabaseController.SetDataSource problem

    This is a Windows application that uses RAS.
    Here is a code snippet:
    Dim rasDataset As ISCRDataSet
    rasDataset = DataSetConverter.Convert(dsProject)
    boSubreportClientDocument.DatabaseController.SetDataSource(rasDataset)
    When I try to set the datasource, I get "The document has no tables"   
    All the data tables required for the report to run are in the dsProject.
    Why do subreports need their dataset converted?  The main reportdocument.SetDatasource takes a normal .net system.data.dataset   ...but the SetDataSource on subreports need to be type ISCRDataSet   ...is this true?
    The report being used as a subreport references tables.  If I run the report as a standalone report, it works fine.
    Thanks,
    Jeff

    Hello Jeff,
    the code below does not use RAS but demonstrates how to pass Datasets to main and subreports in VB.NET.
    Please see if it is of any use for you.
    Thanks
    Falk
    'Purpose:       This Visual Basic .NET sample Windows application demonstrates how to
    '               pass a same dataset to the main report and the subreport
    ''All of these assemblies are required to be able to
    ''access, load, and set database logon.
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Imports System.Data
    Imports System.Data.OleDb
    Public Class Form1
        Inherits System.Windows.Forms.Form
        Dim crReportDocument As New CrystalReport1()
        Dim crOledbConnection As OleDbConnection
        Dim crOledbDataAdapter As OleDbDataAdapter
        Dim ds As DataSet
        Dim crSections As Sections
        Dim crSection As Section
        Dim crReportObjects As ReportObjects
        Dim crReportObject As ReportObject
        Dim crSubreportObject As SubreportObject
        Dim crSubReportDoc As ReportDocument
    #Region " Windows Form Designer generated code "
        Public Sub New()
            MyBase.New()
            'This call is required by the Windows Form Designer.
            InitializeComponent()
            'Add any initialization after the InitializeComponent() call
            'Connection information to connect to the database server to retrieve data
            'This is connecting to SQL server through OLEDB
            Dim ConnectionString As String = ""
            ConnectionString = "Provider=SQLOLEDB;"
            ConnectionString += "Server=Server1;Database=Pubs;"
            ConnectionString += "User ID=myuser;Password=mypassword"
            crOledbConnection = New OleDbConnection(ConnectionString)
            Dim sqlString As String = ""
            sqlString = "Select * From authors"
            crOledbDataAdapter = New OleDbDataAdapter(sqlString, crOledbConnection)
            ds = New DataSet()
            'Fill up the dataset
            crOledbDataAdapter.Fill(ds, "authors")
            'Set the datasource for the main report
            crReportDocument.Database.Tables(0).SetDataSource(ds)
            'Go through each sections in the main report and identify the subreport
            'by name
            crSections = crReportDocument.ReportDefinition.Sections
            For Each crSection In crSections
                crReportObjects = crSection.ReportObjects
                For Each crReportObject In crReportObjects
                    If crReportObject.Kind = ReportObjectKind.SubreportObject Then
                        crSubreportObject = CType(crReportObject, SubreportObject)
                        crSubReportDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
                        'Once the correct subreport has been located pass it the
                        'appropriate dataset
                        If crSubReportDoc.Name = "FirstSub" Then
                                crSubReportDoc.Database.Tables(0).SetDataSource(ds)
                            End If
                        End If
                Next
            Next
            CrystalReportViewer1.ReportSource = crReportDocument
        End Sub
        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer. 
        'Do not modify it using the code editor.
        Friend WithEvents CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.CrystalReportViewer1 = New CrystalDecisions.Windows.Forms.CrystalReportViewer()
            Me.SuspendLayout()
            'CrystalReportViewer1
            Me.CrystalReportViewer1.ActiveViewIndex = -1
            Me.CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill
            Me.CrystalReportViewer1.Name = "CrystalReportViewer1"
            Me.CrystalReportViewer1.ReportSource = Nothing
            Me.CrystalReportViewer1.Size = New System.Drawing.Size(292, 273)
            Me.CrystalReportViewer1.TabIndex = 0
            'Form1
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(292, 273)
            Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.CrystalReportViewer1})
            Me.Name = "Form1"
            Me.Text = "Form1"
            Me.ResumeLayout(False)
        End Sub
    #End Region
    End Class

  • How to create a report based on a DataSet programatically

    I'm working on a CR 2008 Add-in.
    Usage of this add-in is: Let the user choose from a list of predefined datasets, and create a totally empty report with this dataset attached to is. So the user can create a report based on this dataset.
    I have a dataset in memory, and want to create a new report in cr2008.
    The new report is a blank report (with no connection information).
    If I set the ReportDocument.SetDataSource(Dataset dataSet) property, I get the error:
    The report has no tables.
    So I must programmatically define the table definition in my blank report.
    I found the following article: https://boc.sdn.sap.com/node/869, and came up with something like this:
    internal class NewReportWorker : Worker
          public NewReportWorker(string reportFileName)
             : base(reportFileName)
    public override void Process()
             DatabaseController databaseController = ClientDoc.DatabaseController;
             Table table = new Table();
             string tabelName = "Table140";
             table.Name = tabelName;
             table.Alias = tabelName;
             table.QualifiedName = tabelName;
             table.Description = tabelName;
             var fields = new Fields();
             var dbField = new DBField();
             var fieldName = "ID";
             dbField.Description = fieldName;
             dbField.HeadingText = fieldName;
             dbField.Name = fieldName;
             dbField.Type = CrFieldValueTypeEnum.crFieldValueTypeInt64sField;
             fields.Add(dbField);
             dbField = new DBField();
             fieldName = "IDLEGITIMATIEBEWIJS";
             dbField.Description = fieldName;
             dbField.HeadingText = fieldName;
             dbField.Name = fieldName;
             dbField.Type = CrFieldValueTypeEnum.crFieldValueTypeInt64sField;
             fields.Add(dbField);
             // More code for more tables to add.
             table.DataFields = fields;
             //CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo info =
             //   new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
             //info.Attributes.Add("Databse DLL", "xxx.dll");
             //table.ConnectionInfo = info;
             // Here an error occurs.
             databaseController.AddTable(table, null);
             ReportDoc.SetDataSource( [MyFilledDataSet] );
             //object path = @"d:\logfiles\";
             //ClientDoc.SaveAs("test.rpt", ref path, 0);
    The object ClientDoc referes to a ISCDReportClientDocument in a base class:
       internal abstract class Worker
          private ReportDocument _ReportDoc;
          private ISCDReportClientDocument _ClientDoc;
          private string _ReportFileName;
          public Worker(string reportFileName)
             _ReportFileName = reportFileName;
             _ReportDoc = new ReportDocument();
             // Load the report from file path passed by the designer.
             _ReportDoc.Load(reportFileName);
             // Create a RAS Document through In-Proc RAS through the RPTDoc.
             _ClientDoc = _ReportDoc.ReportClientDocument;
          public string ReportFileName
             get
                return _ReportFileName;
          public ReportDocument ReportDoc
             get
                return _ReportDoc;
          public ISCDReportClientDocument ClientDoc
             get
                return _ClientDoc;
    But I get an "Unspecified error" on the line databaseController.AddTable(table, null);
    What am i doing wrong? Or is there another way to create a new report based on a DataSet in C# code?

    Hi,
    Have a look at the snippet code below written for version 9 that you might accommodate to CR 2008, it demonstrates how to create a report based on a DataSet programmatically.
    //=========================================================================
    +           * the following two string values can be modified to reflect your system+
    +          ************************************************************************************************/+
    +          string mdb_path = "C:
    program files
    crystal decisions
    crystal reports 9
    samples
    en
    databases
    xtreme.mdb";    // path to xtreme.mdb file+
    +          string xsd_path = "C:
    Crystal
    rasnet
    ras9_csharp_win_datasetreport
    customer.xsd";  // path to customer schema file+
    +          // Dataset+
    +          OleDbConnection m_connection;                         // ado.net connection+
    +          OleDbDataAdapter m_adapter;                              // ado.net adapter+
    +          System.Data.DataSet m_dataset;                         // ado.net dataset+
    +          // CR variables+
    +          ReportClientDocument m_crReportDocument;          // report client document+
    +          Field m_crFieldCustomer;+
    +          Field m_crFieldCountry;+
    +          void CreateData()+
    +          {+
    +               // Create OLEDB connection+
    +               m_connection = new OleDbConnection();+
    +               m_connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + mdb_path;+
    +               // Create Data Adapter+
    +               m_adapter = new OleDbDataAdapter("select * from Customer where Country='Canada'", m_connection);+
    +               // create dataset and fill+
    +               m_dataset = new System.Data.DataSet();+
    +               m_adapter.Fill(m_dataset, "Customer");+
    +               // create a schema file+
    +               m_dataset.WriteXmlSchema(xsd_path);+
    +          }+
    +          // Adds a DataSource using dataset. Since this does not require intermediate schema file, this method+
    +          // will work in a distributed environment where you have IIS box on server A and RAS Server on server B.+
    +          void AddDataSourceUsingDataSet(+
    +               ReportClientDocument rcDoc,          // report client document+
    +               System.Data.DataSet data)          // dataset+
    +          {+
    +               // add a datasource+
    +               DataSetConverter.AddDataSource(rcDoc, data);+
    +          }+
    +          // Adds a DataSource using a physical schema file. This method require you to have schema file in RAS Server+
    +          // box (NOT ON SDK BOX). In distributed environment where you have IIS on server A and RAS on server B,+
    +          // and you execute CreateData above, schema file is created in IIS box, and this method will fail, because+
    +          // RAS server cannot see that schema file on its local machine. In such environment, you must use method+
    +          // above.+
    +          void AddDataSourceUsingSchemaFile(+
    +               ReportClientDocument rcDoc,          // report client document+
    +               string schema_file_name,          // xml schema file location+
    +               string table_name,                    // table to be added+
    +               System.Data.DataSet data)          // dataset+
    +          {+
    +               PropertyBag crLogonInfo;               // logon info+
    +               PropertyBag crAttributes;               // logon attributes+
    +               ConnectionInfo crConnectionInfo;     // connection info+
    +               CrystalDecisions.ReportAppServer.DataDefModel.Table crTable;+
    +               // database table+
    +               // create logon property+
    +               crLogonInfo = new PropertyBag();+
    +               crLogonInfo["XML File Path"] = schema_file_name;+
    +               // create logon attributes+
    +               crAttributes = new PropertyBag();+
    +               crAttributes["Database DLL"] = "crdb_adoplus.dll";+
    +               crAttributes["QE_DatabaseType"] = "ADO.NET (XML)";+
    +               crAttributes["QE_ServerDescription"] = "NewDataSet";+
    +               crAttributes["QE_SQLDB"] = true;+
    +               crAttributes["QE_LogonProperties"] = crLogonInfo;+
    +               // create connection info+
    +               crConnectionInfo = new ConnectionInfo();+
    +               crConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;+
    +               crConnectionInfo.Attributes = crAttributes;+
    +               // create a table+
    +               crTable = new CrystalDecisions.ReportAppServer.DataDefModel.Table();+
    +               crTable.ConnectionInfo = crConnectionInfo;+
    +               crTable.Name = table_name;+
    +               crTable.Alias = table_name;+
    +               // add a table+
    +               rcDoc.DatabaseController.AddTable(crTable, null);+
    +               // pass dataset+
    +               rcDoc.DatabaseController.SetDataSource(DataSetConverter.Convert(data), table_name, table_name);+
    +          }+
    +          void CreateReport()+
    +          {+
    +               int iField;+
    +               // create ado.net dataset+
    +               CreateData();+
    +               // create report client document+
    +               m_crReportDocument = new ReportClientDocument();+
    +               m_crReportDocument.ReportAppServer = "127.0.0.1";+
    +               // new report document+
    +               m_crReportDocument.New();+
    +               // add a datasource using a schema file+
    +               // note that if you have distributed environment, you should use AddDataSourceUsingDataSet method instead.+
    +               // for more information, refer to comments on these methods.+
    +               AddDataSourceUsingSchemaFile(m_crReportDocument, xsd_path, "Customer", m_dataset);+
    +                              +
    +               // get Customer Name and Country fields+
    +               iField = m_crReportDocument.Database.Tables[0].DataFields.Find("Customer Name", CrFieldDisplayNameTypeEnum.crFieldDisplayNameName, CeLocale.ceLocaleUserDefault);+
    +               m_crFieldCustomer = (Field)m_crReportDocument.Database.Tables[0].DataFields[iField];+
    +               iField = m_crReportDocument.Database.Tables[0].DataFields.Find("Country", CrFieldDisplayNameTypeEnum.crFieldDisplayNameName, CeLocale.ceLocaleUserDefault);+
    +               m_crFieldCountry = (Field)m_crReportDocument.Database.Tables[0].DataFields[iField];+
    +               // add Customer Name and Country fields+
    +               m_crReportDocument.DataDefController.ResultFieldController.Add(-1, m_crFieldCustomer);+
    +               m_crReportDocument.DataDefController.ResultFieldController.Add(-1, m_crFieldCountry);+
    +               // view report+
    +               crystalReportViewer1.ReportSource = m_crReportDocument;+
    +          }+
    +          public Form1()+
    +          {+
    +               //+
    +               // Required for Windows Form Designer support+
    +               //+
    +               InitializeComponent();+
    +               // Create Report+
    +               CreateReport();+
    +               //+
    +               // TODO: Add any constructor code after InitializeComponent call+
    +               //+
    +          }+//=========================================================================

  • How to deploy a web application with CR 13

    Hi,
    I've got a web application under VS2010. All is working fine on the dev computer (as usual). Now I need to deploy this application.
    I've installed on the destination computer the CR redistribute package. I've used the "Build deploy package" in VS2010 to distrib my web apps.
    It runs well on the target computer but when I try to run a report I got the following error code (sorry some text are in french) :
    Server Error in '/WebNegoce_deploy' Application.
    Nom de fichier non valide.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Runtime.InteropServices.COMException: Nom de fichier non valide.
    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 
    Stack Trace:
    [COMException (0x800001fb): Nom de fichier non valide.]
       CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) +0
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) +95
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +270
    [CrystalReportsException: Echec du chargement du rapport]
       CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() +332
       CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) +877
       CrystalDecisions.CrystalReports.Engine.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob) +1183
       CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport() +113
       CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) +53
       CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet) +66
       WebNegoce.libs.imprime_Semaine(DevisFacHeader& objDevis, DataAccess& ObjConn, String& PrintDest, String& computerName) in D:\Negoce.2010\WebNegoce\libs.vb:31
       WebNegoce.TypePrint.Traitement(String Sortie) in D:\Negoce.2010\WebNegoce\TypePrint.aspx.vb:46
       WebNegoce.TypePrint.ImageButton2_Click(Object sender, ImageClickEventArgs e) in D:\Negoce.2010\WebNegoce\TypePrint.aspx.vb:39
       System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115
       System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +120
       System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
    What should I add in VS2010 to build my deploy package ?
    Thx in advance
    Sybux

    See if KB [1544708  - What are the runtime dependencies for CRVS2010?|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333533343334333733303338%7D.do] will help.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Maybe you are looking for

  • Data access error while running  the script in fdm workbench script editor

    Hello Experts, I have been getting the error when i run the script in script editor of fdqm workbench client.this is the error                           -2147467259 Data access error and it is navigating the error at line 30 about this script "Set rs

  • Commercial playing in the background of computer ever since flash player has been downloaded

    Ever since I've downloaded the flash player there are commercials playing in the background.  And this starts as soon as I power up my computer.  I've tried every way to try and stop it, but havent been able to.

  • PS elements download.

    Downloaded PS elements 13 but when trying to run the application file it says missing archive files that should be downloaded.  don't know where to go.

  • Remotely accessing a CCTV system - questions :)

    Hi I want to remotely access my CCTV system that's set up using multiple cameras and a DVR. The DVR has an ethernet port to connect to a router. The problem I think I have is that I can only get a 3G service where I am and therefore I use a 3G router

  • Error within packaged apps

    I got an "insuficient Privileges" when installing the apps packs. Create table xxx "insuficient Privileges", i did connected with a user that is Workspace admin. ¿whats wrong?. thx in advance