CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Peter's Gekko

public Blog MyNotepad : Imho { }

Out of control

  • 500. And now this blog is out of control

    Yesterday Jeffrey published his 500th post without even mentioning the milestone. Scott Sam was aware of his 150th New and Notable. And today this is my 500th post. Some short words looking back and ahead.

    Over the posts and years a lot has happened. To me the most fascinating is that I'm no longer writing all content by myself. The long list of comments on some posts have turned into an autonomous form of community life. Recently I publicly asked for advice on how to manage that. Which led to good feedback and a plan : Hereby I'm giving up control over (part of) my blog. I've created a new post category: out of control and will use that to mark (old) posts. Which indicates that I will only do the primal moderation; that is delete comments which are abusive or (to far) off topic. But I am not going to go into all content myself. Anybody else who would like to say something on the subject is more than welcome. Be my guest.

    Looking ahead there are more plans than time. The TDD virus has also hit me which already resulted in a public confession. (The newly converted are the worst..) At the moment I'm working with a team who's making their first steps using the VSTS test tools instead of the usual nUnit. There is fodder there, after all it's the methodology, not the tool. But first comes the man. On staying in physical shape by living better I want to do more with my (other) CycleBetter blog. IT and cycling do share interesting things like a Vista gadget helping me to plan a dry ride or a Windows mobile device helping me to find my way touring the hills of France.

    Of course, there will be more of the usual tidbits I meet in the huge world .NET and whatever crosses it's path. But whatever what I've written or am going to write, the Codebetter community is a fantastic place to do that. I have learned so much over here and hope that me and all commenting co-writers can keep up for another 500.

  • Fixing a broken asp.net installation. (The Web server

    This is my third post with this title. What started as quick command line fix has grown into something huge, including top numbers of hits and comments here on Codebetter. So it's worth continuing. An asp.net 1.1 installation on IIS can get broken resulting in the error message in the title. When you're lucky a fix can be done in a couple of seconds from the command line, as described in my first shot. This post was the start of an enormous discussion, making me wandering about a wiki. My second post was a round up of all comments and suggestions, which reached as far as reinstalling Windows itself. Which is another wiki by now. (You can do that on msdn these days)

    The main problem in a lot of scenarios are the security settings. In this post I'll discuss these in more detail.

    When developing web applications there are two users which are important. First there is the aspnet machine account. This is the account under which an application runs in the IIS web server. The account is pretty restricted, to prevent as much damage as possible in case the app is compromised. The other account is the VS developers group. You, working in Visual Studio, are part of that group.

    The security setting on the wwwroot directory are crucial. For the share

    VS developpers need full control here. To create a new web app for instance.

    The security settings for the directory itself: the ASP.NET machine account needs the right to read, execute and list the folder's contents.

    The Visual Studio developers groups needs a more complicated set of rights. To set these click the advanced button and select the VS developers in the advanced security settings dialog.

    Check allow for every entry except Full control, take ownership and change permissions.

    Having done all this you and your web server should have the rights necessary to build apps again.

    Some people reported problems with COM+, the DTC and IIS. I cannot check this but bet you another blogpost there is a related solution for that. Of course you can reinstall everything but I think the only essential part in the installation script is setting the permissions right. Doing that by hand is faster.

  • Using localhost as mailserver (5.7.1 Unable to relay for xxx)

    With .NET 2.0 writing code which uses the IIS webserver to send mail has become even more powerful. The System.Net.Mail namespace has some rich classes.

    private static void SendMailWithIIS(string subject, string body, string to)

    {

        MailMessage message = new MailMessage();

        message.From =  new MailAddress("Me@Spammer.net");

        message.To.Add(to);

        message.Subject = subject;

        message.Body = body;

        message.BodyEncoding = System.Text.Encoding.ASCII;

        message.IsBodyHtml = true;

        message.Priority = MailPriority.Normal;

     

        SmtpClient smtp = new SmtpClient("Localhost");

        smtp.Send(message);

    }

    The .NET docs even contain a sample to send mail asynchronous. The hard part lies not in the code but in the configuration of localhost. It considers itself being used as a mail relay and by default it does not allow anyone to do that. In your code you'll get the error message : Mailbox unavailable. The server response was: 5.7.1 Unable to relay for

    To fix it you have to configure relay restrictions in the IIS admin.

    Here I've set localhost, aka 127.0.0.1, as the only one allowed to relay mail. And now my .NET code can spam everybody. Use with care !

  • Using SQL reporting services in an asp.net application with some notes on report parameters

    In the Crystal days adding reports to an asp.net application could give you quite a hard time. Having  dropped crystal in favor of sql reporting services (so far) just annoying little stuff keeps me busy. In this post I'll demonstrate how to add RS reports to an asp.net application and concentrate on fixing the annoyances.

    To the application reports are available as an URL on the report server. You add reports to an asp.net application by hyper-linking to them. Displaying the reports requires authentication and authorization, anonymous access does not work. By default no-one has browsing rights. In the report manger, which is another URL to the report server, you set the browsing rights under the security tab.

    Provided the user has the necessary rights the browser will show the report with a viewer toolbar. In the toolbar is the option to export or print the report. Make sure you have installed service pack 2 of reporting services or else the print button will be missing. For the print to work RS will (try to) install a little client side ActiveX control which provides a print preview and a clean print.

    A report can have parameters, these are defined in the report's design. You can pass parameter values at runtime provided that the report has the prompt property of its parameters set. If this property is not set you get a nasty reporting services error. There are two way to pass parameters, either in the parameters pane of the report toolbar or in the URL. When you're linking to a report from an application passing the parameters in the URL is  the most likely thing to do. This snippet builds an URL. It does include two parameter values.

    string reportserver = System.Configuration.ConfigurationSettings.AppSettings["ReportServer"] + "{0}&rs:Parameters=false&rs:Command=Render&rs:ClearSession=true";
    string reportUrl = String.Format("UrenVerdeling&idGebruiker={0}&sort={1}",CurrentUser.ID, sortOn);
    Response.Redirect(string.Format(reportServer, reportUrl));
     

    To hide the parameter pane in the browser bar you are supposed to pass rs:Parameters=false in the Url. But to hide the pane also the prompt string, asking for a parameter value, should be empty. The prompt string is set in the report designer (in VS)

    Now there is a little quirk. In the report definition itself there are two settings for the prompt. A logical one which determines whether to prompt and a string what text to prompt. The report designer lumps these two; an empty string will set the prompt flag to false. Which will result in the exception mentioned. In the report manager you set these two properties independently. To be able to set the parameter from the URL and hide the parameter pane you have to check the prompt checkbox and empty the prompt string textbox.

    You don't have to pass in every report parameter. As you see in the report manager there is also a Null column.

    When the Null checkbox is checked a parameter can be omitted. Its value will be according to the expression in the Default Value textbox. The VS report designer has several options for that, non-queried, from-query or none. This is again an oversimplification of the underlying parameter properties. To get a default value of NULL for the parameter you have to check the has default and  Null checkboxes as well as empty the Default Value textbox. Also this can only be done right in the report manager.

    Now I have a great flexibility and can still keep the URL as simple as possible.

    System.Text.StringBuilder sb = new System.Text.StringBuilder("UrenverdelingTotaal");
    sb.Append("&CursusJaar=" + CurrentUser.CursusJaarOmschrijving);
    sb.Append("&Sortering=" + DropDownListSortering.SelectedIndex.ToString());
    sb.Append("&idGebruiker=" + CurrentUser.ID.ToString());
    sb.Append("&SelOnderwijs=" + (CheckBoxOnderwijs.Checked ? "1" : "-1"));
    sb.Append("&SelOpleiding=" + (CheckBoxOpleiding.Checked ? "1" : "-1"));
    sb.Append("&SelSchool=" + (CheckBoxSchool.Checked ? "1" : "-1"));
    if (DropDownListSchool.SelectedIndex > 0)
       sb.Append("&Afdeling=" + DropDownListSchool.SelectedValue.Trim());
    if (DropDownListOpleiding.SelectedIndex > 0)
       sb.Append("&Opleiding=" + DropDownListOpleiding.SelectedValue.Trim());
    if (DropDownListAfkorting.SelectedIndex > 0)
        sb.Append("&Afkorting=" + DropDownListAfkorting.SelectedValue.Trim());
    if (DropDownListNaam.SelectedIndex > 0)
        sb.Append("&Naam=" + DropDownListNaam.SelectedValue.Trim());
    if (DropDownListKostenplaats.SelectedIndex > 0)
        sb.Append("&KostenPlaats=" + DropDownListKostenplaats.SelectedValue.Trim());
    if (DropDownListTelcode.SelectedIndex > 0)
        sb.Append("&TelCode=" + DropDownListTelcode.SelectedValue.Trim());
    if (DropdownlistJaargang.SelectedIndex > 0)
        sb.Append("&Jaargang=" + DropdownlistJaargang.SelectedValue.Trim());
    if (DropDownListPeriode.SelectedIndex > 0)
       sb.Append("&Periode=" + DropDownListPeriode.SelectedValue.Trim());
    if (DropDownListOnderdeel.SelectedIndex > 0)
       sb.Append("&Onderdeel=" + DropDownListOnderdeel.SelectedValue.Trim());
    if (TextBoxOpmerking.Text != "")
       sb.Append(string.Format("&Opmerking={0}%", TextBoxOpmerking.Text.Trim()));


    Response.Redirect(string.Format(reportServer, sb.ToString()), true);
     

    I had found the answer to the prompt problem here in a blogpost whose comments had turned it into just the kind of wiki (loads of comments where the commenters start discussing solutions) some of my old Crystal Reports post have turned into. The solution found  was also applicable to default parameter values. Getting reporting to work (right) is such grateful blog-fodder :)

  • Fixing a broken asp.net installation. (The Web server reported the following error when attempting to create or open the Web project located at the following....) revisited

    November last year I posted a story with this title. It was a fix for the error messgae above. I wasn't the only one having this problem, over time many many comments and comments on the comments were added. It should be turned into a Wiki. In this post I will try to summarize the most usefull comments.

    In the original post I suggested 

    1. aspnet_regiis -i

    to fix the problem. This can be done in a jiffy. In the course of the comments the most succesfull script has grown to

    1. uninstall IIS
    2. delete (rename) the inetpub directory
    3. Make sure the "Distributed Transaction Coordinator" service is running
    4. reinstall IIS
    5. regsvr32 aspnet_isapi.dll
    6. perform aspnet_regiis -i

    which is quite a big job.

    What shines through in a lot of the comments is that the problem is often a security setting. The many installations will set the permissions leading to an ASP.NET server working right. Correcting the permissions by hand might be a faster fix. So before you follow this script I suggest you check the ASPNET account. Does it have sufficient permissions in the wwwroot directory ? Might be a lot a faster.

    <Update>Check this post for a detailed description of the security settings.</>

    Peter

  • Merging webapps. Moving (typed) Crystal reports from one application to another.

    Two of my projects got so entangled that the only way out was merging them into one. They were several asp.net apps which had (code) references to each other. Two of them refering each other made the situation unworkable. Building the setup packages resulted in one working or the other working, depending which package I built first. When creating a setup package vs first builds all the projects in the package. When an assembly is refered it will be rebuilt and included. When an assembly is included in more than one package it is rebuild more than once. Leading to versioning hell.

    I created a new web app and created some folders in it (from the VS solution explorer !) To these folders I added the content and code from the former apps. Works like a snap. Except for my (what else ?) Crystal reports. 90% of the conversion time was spent on getting these to work. This time the process was interesting.

    Including the report “as is” leads to a succesfull build but an enigmatic error message at runtime:

    Unable to find the report in the manifest resources

    My apps use strong typed reports and reportdocuments from the component palette

    Several observations

    • A report looks like a rpt file. Behind the scenes is a (generated) cs file
    • This cs file is generated when you save the report design. See the custom tool in the proprties of a report.
    • That code is generated in the namespace of the application.
    • The reportdocument is refred in the namespace of the page hosting it

    The combination of the last two results in the error. To get things working took me these steps.

    1. Include the reports in the project
    2. Open the designer and save (to regenerate the report code)
    3. Make sure the pages on which the report is used are in the default namespace of the application
    4. Do not use reportdocuments

    Step 3 is easier in C# then VB. Here you see the namespace in the code behind. Changing the name will have the desired effect. To get an overview of the namespaces in your app use the class viewer.

    Too much of the reportdocument component is hard coded. Creating the report on the fly works just as well.

    private MotivatieRaport mv = new MotivatieRaport();
    dataSetProjektTonen.Merge(Projekt.ToonBaarProjekt(id));
    mv.SetDataSource(dataSetProjektTonen);
    CrystalReportViewer1.ReportSource = mv;

    The only extra line is the first one.

    Peter

     

  • Mailto links

    Recently my neighbour Warnar blogged a little on sending mail from an app. He explained how to use the smtpserver on the webserver. Recently I needed some mail functionality on the client machine. A web-page should start an email message to be sent by Outlook (Express) or whatever other client used.

    This is a snap using mailto links. Clicking a mailtolink will fire up the emailclient, the browser will take care of the details. The mailto protocol supports several parameters, see here for more details. Take this link:

    mailto:Peter@Gekko-Software.nl?subject=From the weblog&body=Your comments here

    Click it to mail me (Spam filter is active). The link is typed directly into the navigateUrl property of a hyperlink. To customize it you use databinding.

    My app had to generate messages with a body which contained a new link to some web page. At first sight this code would generate that :

    result = string.Format("mailto:{0}?subject={1}&body={2}", email, subject, body);

    It did not work, as the link in the body often contains an &-character. This character separates parameters of the mailto-link. The result would be that anything after the & will not be in the body. Another thing to watch is that a link cannot return line-feeds. And it does not like “'s either. As I did not find anything in the framework which will creat a valid link out of just any text I solved it by applying several Replace calls to the string.

    string quote = new string('"', 1);
    body = mail.Body.Replace(System.Environment.NewLine, "%0A").Replace(quote, "%22").Replace("&", "%26");

    Have I overlooked something in the framework ? Is this a full clean ?

    The result is that my web pages now contain fully functional mailto's. Customer loves it.

    Peter

     

  • Exporting from Crystal Reports to PDF, Word, Excel and HTML

    Crystal Reports is a welcome subjects for blog posts. I still do like the product, my users are very happy with the results, the report editor is not that bad to work with and the components integrate well into a solution. But Crystal documentation is an absolute disaster. I wanted to add some functionality to my basic export routine. The only thing was adding export to Excel and to html. This functionality is present in the basic Crystal installation but how to use it is something which took me really a lot of Googling. The answers were not on the Crystal site but in the dungeons of the usenet. Let me share what I found.

    On of the things I learned is that you have to Close() a report after exporting. This was not in the official Crystal example. I havn't measured the effect but it doesn't harm.

    Exporting to Excel turned out to be just a matter of setting the right content type. This type turned out to be application/vnd.ms-excel. I had expected application/msexcel, as a nice sibling to application/msword. Exporting to Excel has some extra format options but you can do without them for a basic export. I'll leave these for another post.

    To get the exporting to html to work took some things which are next to ridiculous, but I got it working. You have to set some format options. In these options you set the root directory and the filename. This directory-filename pair should be identical to the export filename passed to the report. The result will be an html formatted report, but in a "slightly" different location. To find the result you have to do some tricks. When Crystals creates a report is does create a temporary .rpt file. This file is stored in the windows\temp dir, it's name is a guid. When Crystal creates the exported report it creates a directory in the root directory supplied with the name of this guid. In this directory the report will be created, using the filename supplied. Thank goodness the name of the temporary file is available in the FilePath property of the report. This snippet demonstrates the workaround:

    string[] fp = selectedReport.FilePath.Split("\\".ToCharArray());
    string leafDir = fp[fp.Length-1];
    // strip .rpt extension
    leafDir = leafDir.Substring(0, leafDir.Length - 4);
    tempFileNameUsed = string.Format("{0}{1}\\{2}", tempDir, leafDir, tempFileName);

    To sum it all up :

    protected void exportReport(CrystalDecisions.CrystalReports.Engine.ReportClass selectedReport, CrystalDecisions.Shared.ExportFormatType eft)
    {
        selectedReport.ExportOptions.ExportFormatType = eft;

        string contentType ="";
        // Make sure asp.net has create and delete permissions in the directory
        string tempDir = System.Configuration.ConfigurationSettings.AppSettings["TempDir"];
        string tempFileName = Session.SessionID.ToString() + ".";
        switch (eft)
        {
        case CrystalDecisions.Shared.ExportFormatType.PortableDocFormat :
            tempFileName += "pdf";
            contentType = "application/pdf";
            break;
        case CrystalDecisions.Shared.ExportFormatType.WordForWindows :
            tempFileName+= "doc";
            contentType = "application/msword";
            break;
        case CrystalDecisions.Shared.ExportFormatType.Excel :
            tempFileName+= "xls";
            contentType = "application/vnd.ms-excel";
            break;
        case CrystalDecisions.Shared.ExportFormatType.HTML32 :
        case CrystalDecisions.Shared.ExportFormatType.HTML40 :
            tempFileName+= "htm";
            contentType = "text/html";
            CrystalDecisions.Shared.HTMLFormatOptions hop = new CrystalDecisions.Shared.HTMLFormatOptions();
            hop.HTMLBaseFolderName = tempDir;
            hop.HTMLFileName = tempFileName;
            selectedReport.ExportOptions.FormatOptions = hop;
            break;
        }

        CrystalDecisions.Shared.DiskFileDestinationOptions dfo = new CrystalDecisions.Shared.DiskFileDestinationOptions();
        dfo.DiskFileName = tempDir + tempFileName;
        selectedReport.ExportOptions.DestinationOptions = dfo;
        selectedReport.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;

        selectedReport.Export();
        selectedReport.Close();

        string tempFileNameUsed;
        if (eft == CrystalDecisions.Shared.ExportFormatType.HTML32 || eft == CrystalDecisions.Shared.ExportFormatType.HTML40)
        {
            string[] fp = selectedReport.FilePath.Split("\\".ToCharArray());
            string leafDir = fp[fp.Length-1];
            // strip .rpt extension
            leafDir = leafDir.Substring(0, leafDir.Length - 4);
            tempFileNameUsed = string.Format("{0}{1}\\{2}", tempDir, leafDir, tempFileName);
        }
        else
            tempFileNameUsed = tempDir + tempFileName;

        Response.ClearContent();
        Response.ClearHeaders();
        Response.ContentType = contentType;

        Response.WriteFile(tempFileNameUsed);
        Response.Flush();
        Response.Close();

        System.IO.File.Delete(tempFileNameUsed);
    }

    Which is pretty straightforward and even works. With a lot of thanks to the many people on the web who have also been strugling with this.

    Peter

  • Once more on Crystal (Access to report file denied)

    I still do like Crystal reports but getting them to work on a production machine can be pretty frustrating. Responses to earlier posts showed me that I'm not the only one. So here's another.

    You can print a Crystal report on a webpage by exporting it as a PDF or a Word doc. The browser will catch this in a viewer from where you do the real printing. There is a sample on the Crystal website which I followed quite sheepishly. It worked on my machine but the production machine showed a quite interesting error

    C:\DOCUME~1\S01NT0~1\ASPNET\LOCALS~1\Temp\temp_b8805d74-11f7-4721-b614-88b564c0b8a4.rpt: Access to report file denied. Another program may be using it.

    There is indeed an access problem, but not with the report file. Browsing the web I found the solution on the Crystal site. This led me to do some refactoring on the example which resulted in a helper method I would like to share with you:

    protected void exportReport(CrystalDecisions.CrystalReports.Engine.ReportClass selectedReport, CrystalDecisions.Shared.ExportFormatType eft)
    {

    string contentType ="";
    // Make sure asp.net has create and delete permissions in the directory
    string tempFileName = System.Configuration.ConfigurationSettings.AppSettings["TempDir"] + Session.SessionID.ToString() + ".";

    switch (eft)
    {
    case CrystalDecisions.Shared.ExportFormatType.PortableDocFormat :
    tempFileName += "pdf";
    contentType = "application/pdf";
    break;

    case CrystalDecisions.Shared.ExportFormatType.WordForWindows :
    tempFileName+= "doc";
    contentType = "application/msword";
    break;

    }

    CrystalDecisions.Shared.DiskFileDestinationOptions dfo = new CrystalDecisions.Shared.DiskFileDestinationOptions();
    dfo.DiskFileName = tempFileName;

    CrystalDecisions.Shared.ExportOptions eo = selectedReport.ExportOptions;
    eo.DestinationOptions = dfo;
    eo.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
    eo.ExportFormatType = eft;

    selectedReport.Export();
    Response.ClearContent();
    Response.ClearHeaders();
    Response.ContentType = contentType;

    Response.WriteFile(tempFileName);
    Response.Flush();
    Response.Close();

    System.IO.File.Delete(tempFileName);

    }

    You pass the method the report and the desired format in the parameters. The code is pretty straightforward. The essential thing is that you have to create a temporary file for the result. To create this file your app needs some rights. To make sure the app will have the rights we added an entry in the web.config and the code will read this using the AppSettings property. System management can now assign a scratch dir

    Part of web.config

    <appSettings>
    <add key="TempDir" value
    ="c:\temp\">add>

    And this does work.

    Blog on, Peter

    <appSettings>
    <add key="TempDir" value
    ="c:\temp\">add>

    And this does work.

    Blog on, Peter

  • Get your Crystal report working on your customers server (Cannot find KeycodeV2.dll, or invalid keycode)

    Actually I do like Crystal Reports. It may not be perfect but the way it works with datasets, its grouping a selecting options and the web report viewer are very workable. Deploying Crystal Report to a web server is another story.

    When you test your app on your localhost all seems to be working well but when the app is installed on the webserver it produces the notorious Cannot find KeycodeV2.dll, or invalid keycode error message. The Crystal site has loads on support on that which tells you to update some registry settings. There is a big chance that you will not find these settings. What to do next is hidden a lot better in the docs.

    The crystal viewer uses a couple of dll's which are installed on your development machine. They are part of CR for VS.NET but not of the .NET framework. If there is no vs.net installed on the webserver these files will be missing on the server. A deployment project in VS.NET will not see the dependencies and will not include them in the setup. What worked for me (destilled out of the loads of CR docs) was creating a setup project with a couple of merge modules

    • Crystal_Database_Access2003.msm
    • Crystal_Database_Access2003_enu.msm
    • Crystal_Managed2003.msm
    • Crystal_regwiz2003.msm
    • VC_User_CRT71_RTL_X86_---.msm (used for reports based on ADO.NET)
    • VC_User_STL71_RTL_X86_---.msm (used for reports based on ADO.NET)

    The regwiz module has an License key property, here you enter the Crystal license key found in the help about of VS.NET. It will read something like AAP50-GS00000-U7000RN.

    Installing this dummy app will enable CR in all your webservers applications. On one server the setup was a webapp, on another server we had to create a Windows forms setup before the server would see CR.

    Blog on, Peter

  • Fixing a broken asp.net installation. (The Web server reported the following error when attempting to create or open the Web project located at the following....)

    After a failing installation of a VS.NET 2003 add-in, possibly because I  have Whidbey and 2003 running in parallel, I had quite a hard time to get everything working again. I found a lot of hits in support groups, a lot of solutions but nothing worked. The The Web server reported the following error when attempting to create or open the Web project located at the following .. (Internal Server error 500) message kept on hitting me whenever I tried to open or create a project.

    What finally helped was taking a closer look at the aspnet_regiis utility. In many solutions you are advised to use this with the -s option to register asp.net with your webapps

     -s <path>  - Install scriptmaps for this version at the specified path,
                  recursively. Existing scriptmaps of lower version are
                  upgraded to this version.
                  E.g. aspnet_regiis.exe -s W3SVC/1/ROOT/SampleApp1

    What finally worked was using the -i option

     -i         - Install this version of ASP.NET and update scriptmaps
                  at the IIS metabase root and for all scriptmaps below
                  the root. Existing scriptmaps of lower version are
                  upgraded to this version.

    RTFcommand line !

    <Update A summary and discussion of the many comments on this post can be found here. Read it !</Update>

    blog on

    Peter

  • Moving Crystal reports to 2003, not that clear

    I had updated a project from VS.NET 2002 to 2003. No big deal, till the moment I checked the (Crystal) reports. It took me some time to find out so let me share this with you.

    In web.config theres is this section

     

    <compilation defaultLanguage="c#" debug="true"><assemblies><add assembly="CrystalDecisions.CrystalReports.Engine, Version=9.1.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.ReportSource, Version=9.1.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Shared, Version=9.1.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/><add assembly="CrystalDecisions.Web, Version=9.1.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>FONT color=#800000 size=3>assemblies>FONT color=#800000 size=3>compilation>

    In there are some references to Crystal assemblies with an explicit version number. To get things to work again you have to update this version nummber to the version of the 1.1 assemblies. Which is 9.1.5000.0

     

    <compilation defaultLanguage="c#" debug="true">

     

    <assemblies>

     

    <add assembly="CrystalDecisions.CrystalReports.Engine, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

     

    <add assembly="CrystalDecisions.ReportSource, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

     

    <add assembly="CrystalDecisions.Shared, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

     

    <add assembly="CrystalDecisions.Web, Version=9.1.5000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>

     

    FONT color=#800000 size=3>assemblies>

     

    FONT color=#800000 size=3>compilation>

    After this all worked like a snap. I (Google) did not find any clear hints on this, had to find out step by step. Quite interesting but it does take some time.

    Actually I am quite pleased with Crystal reports. Powerfull and flexible. But the docs are a traditional nightmare. This is what I destilled for my report:

    • Add a new report to the project.
    • Designing it using a local XML dataset for the data
    • Drop a report component on the webpage.
    • Make it a typed report, typed according to the report in the project
    • Drop a viewer on the webform
    • Tie everything together in the page_load :

    reportProjekt1.SetDataSource(dataSetReport1);

    CrystalReportViewer1.ReportSource = reportProjekt1;

    That's all, a couple of clicks and two lines of code...

    Blog on,

    Peter

More Posts

This Blog

Syndication

News