Crystal Report Hosting

All about Crystal Report Hosting

Crystal Report Hosting :: How to solve an error "Failed to create the Crystal Query Engine"?

clock November 27, 2011 15:34 by author Administrator

Symptom:
When attempting to run a report, an error message states: 'Failed to Create the Crystal Query Engine'.

Solution 1:
There may be mismatched Crystal report DLLs in the system32 directory.

Rename the CRPE32.DLL file in the C:\Windows\System32 directory to CRPE32.DLL.OLD and reinstall the program.  A new CRPE32.DLL file will be installed that should match all the other dll versions.

Solution 2:
You may have Crystal Reports installed and the dll needs to be re-registered.

1. Quit Crystal Reports.
2. On the Windows taskbar, click the 'Start' button and then click 'Run'.
3. Type: 'regsvr32 "C:\Windows\System32\crqe.dll"'.
4. Click 'OK'.

A message appears indicating the file is successfully registered. If the file does not register correctly, try solutions 2.

Note:
You may need to locate the crqe.dll if it is not in the c:\windows\system32 direcotry. In this case, on the Windows taskbar, click the 'Start' button > Find (or Search) > Files and Folders. Enter crqe.dll and perform search. Note the location and substitue the path to register this file.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report 2008/2010 Hosting :: Crystal Report Between Two Dates using a Stored Procedure

clock November 14, 2011 16:55 by author darwin

Step 1: Open a Windows Forms Application & place 2 DateTimePicker controls and a Button control in the form.

As shown in the form below:



Write this code under a Form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Shared;
using CrystalDecisions.Windows.Forms;


namespace Student
{
    public partial class DateWise : Form
    {

        public DateWise()
        {
            InitializeComponent();
        }
        private void DateWise_Load(object sender, EventArgs e)
        {
 
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DateReport datereport = new DateReport();
            datereport.toDate = Convert.ToDateTime(cbTodate.Value);
            datereport.FromDate = Convert.ToDateTime(cbFromDate.Value);
            datereport.ShowDialog(); 
        }      
    }
}

Step 2: Creating a report: go to the Solution Explorer and add a new item in LHS Categories choose Reporting 7 in RHS choose Cryatal Rerport Template & give a name for it then click thge Add Button then open a Galary and choose a Blank Report then open a window and go to Field Explorer, choose Database field then right click and select Database Expert.

Wizard choose Create New Connection, explore it choose OLEDB (ADO) for the Provider and select the provider named Microsoft OLEDB Provider For SQL Server / SQL Native Client (only for SQL Server) then click Next and fill in Connection Information & click Finish.

Then the Report Creation Wizard is opened.

Now in the Report Wizard choose Database; explore it 7 choose the
Stored Procedure that your want as shown below.



Step 3: Click ok then go to Field Exploorer & choose Stored Procedure; explore it & drag & drop field in Report Sesion (Details) & design it as per your requirements.

Step 4: If you want to pass a parameter to a report then right-click on Parameters Field in field Explorer. Then click on New.

For e.g.



Now Create a parameter called fromdate as the start date.



Similarly create a ToDate parameter.

CompanyName,Address,Website Follow the above procedure

Step 5: Design the Report as shown in the screen below.



Step 6:

(launching the Report) Add a new form and place a Crystal Report Viewer Control on it; set the Windows state property to Maximized.

Add a reference for System. Configuration assembly also add "Application Configuration File" i.e.app Config & under it write the following:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
  </configSections>
  <connectionStrings>
    <add name="Student.Properties.Settings.StudentConnectionString"
      connectionString="Data Source=.;Initial Catalog=Student;User ID=sa;Password=p@ssw0rd"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings >
    <add key="CName" value="XYZ Software Solution"/>
    <add key="Addr" value=" Address-"/>
    <add key="WebSite" value=" Website:"/>
    <add key="Y5Institute" value="Data Source=C1;Initial Catalog=Student;User ID=sa;Password=p@ssw0rd;"/>
  </appSettings>
</configuration>

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace Student
{
    public partial class ReportSelection : Form
    {

        internal DateTime ToDate;
        internal DateTime FromDate;
        public ReportSelection()
        {
            InitializeComponent();
        }

        private void ReportSelection_Load(object sender, EventArgs e)
        {
            ConnectionInfo CInfo = new ConnectionInfo();
            CInfo.ServerName = "Connection"// This Should be the same name What we have Configured under Oledb(ADO)
            CInfo.UserID = "sa";
            CInfo.Password = "p@ssw0rd";

            TableLogOnInfo tableInfo = new TableLogOnInfo(); // providing table Details  use the Seperate object of TableLogOnInfo Class for each table we use in the Report
            tableInfo.ConnectionInfo = CInfo;

            TableLogOnInfos tablelog = new TableLogOnInfos();
            tablelog.Add(tableInfo);
            crystalReportViewer1.ReportSource = "F:\\kiran\\Student\\Student\\StudentFees.rpt"; //<"Path of the report">;
            crystalReportViewer1.LogOnInfo = tablelog;

          // Using Above Coding to Skip/Elliminate user Id,passaword i.e.Connection Datails

            string cname = ConfigurationManager.AppSettings.Get("CName");
            string addr = ConfigurationManager.AppSettings.Get("Addr");
            string Website = ConfigurationManager.AppSettings.Get("WebSite");          
            ReportDocument obj = new ReportDocument();
            obj.Load("F:\\kiran\\Student\\Student\\StudentFees.rpt");
            crystalReportViewer1.ReportSource = obj;
            obj.SetParameterValue("CompanyName", cname);
            obj.SetParameterValue("Address", addr);
            obj.SetParameterValue("Company Website", Website);
            obj.SetParameterValue("@StattDate",ToDate);
            obj.SetParameterValue("@EndDate",FromDate); 
            
        }
    }
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report 2010 Hosting :: How to Use Crystal Report 2010 in Visual Studio 2010

clock November 10, 2011 13:56 by author darwin

Yesterday, I have shown you how to create setup and deployment project with Crystal Report in VS 2008. Now, I will show you how to use Crystal Report 2010 in Visual Studio 2010. And this is the procedure that you need to follow.

1. Download the CR2010 beta 2 from Business Object Website.
2.
Crystal Reports for Visual Studio 2010.
3.
Crystal Reports Runtime engine for .net framework 4.0 (32 bit).
4.
Crystal Reports Runtime engine for .net framework 4.0 (64 bit).
5. You are going to need these two installer the CR2010 for VS2010 and the Crystal Report Runtime Engine.
6. Any previous installed crystal report should uninstall first before installing the new release.

Or you can now download the Production Release from the ff:

1.
SAP Crystal Report Version for Visual Studio 2010.
2. Click Once SAP Crystal Reports, version for Visual Studio 2010 -
3. Merge Module SAP Crystal Reports, version for Visual Studio 2010 -
4.
SAP Crystal Reports runtime engine for .NET Framework 4 (32-bit).
5.
SAP Crystal Reports runtime engine for .NET Framework 4 (64-bit).

Now install Crystal Reports For Visual Studio 2010 on your developer machine and as well as Runtime Engine. Create a setup program on your project, on Project Solution Explorer right click the setup, in the picture below it shows AISCollection and select  properties:



Now install Crystal Reports For Visual Studio 2010 on your developer machine and as well as Runtime Engine. Create a setup program on your project, on Project Solution Explorer right click the setup, in the picture below it shows AISCollection and select  properties:



If you cannot see Crystal Report 2010 Runtime, surely it will not appear on your Prerequisites dialog because it was manually created using Bootstrapper Manifest Generator for Visual Studio 2008 you can download the Bootstrapper Manifest Generator 
HERE to generate a prerequisite installer on your project. The same way with framework2 and Microsoft  data Access Component  for VS2010 all was created using Bootstrapper Manifest Generator. Crystal Report 2010 beta uses the .net framework 2.0 that’s why you need to include it on your setup. program. As an alternative way  if you don’t want to create a prerequisite installer for that, you need to manually install the runtime and the .net framework 2.0 including the Microsoft data Access Component 2.8 on your client machine before all things will work perfectly.  The Tutorials on how to use the Bootstrapper Manifest Generator will be available soon, please come back and check it here regularly.

Issue Arising After Installing the new Crystal Report Production Release.

Upon Compiling your projects if you do experience a not found error “crdb_adoplus.dll“, all you have to do are:


1. Go to the folder “C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86” and copy the crdb_adoplus.dll into dotnet1 folder, if the dotnet1 folder does not exist on ”C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86” create it and copy the crdb_adoplus.dll on this folder (dotnet1).

2. The above File path will look like “C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll“.

3. Now open your Application’s Configuration File “[ProjectName].exe.config” if your Project name ismyCollection then the Configuration File will be “myCollection.exe.config“, Locate the ff: line

<supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.0″/>
</startup>

and replace it with the ff:

<startup useLegacyV2RuntimeActivationPolicy=”true”>
<supportedRuntime version=”v4.0″/>
</startup>


This will tell Visual Studio to Support the Runtime Version 4.0, failed to do it will result in the ff: error

“Mixed mode assembly is built against version ‘v2.0.50727′ of the runtime
and cannot be loaded in the 4.0 runtime without additional configuration information.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report 2008 Hosting :: How To Create Setup And Deployment Project With Crystal Report In VS Studio 2008

clock November 8, 2011 14:43 by author darwin

In this article, I will show you how to create your own Setup package that should be able to install the sample application on any windows machine. The sample application is a Windows form project that loads a crystal report file. After completion of this tutorial, you should be able to deploy the sample project, Microsoft .NET Framework and Crystal Report Runtime on the target machine.

1. Create a New Project by Going To "File > New > Project". Select "Other Project Types > Setup and Deployment" from the list of Project Types.
2. Choose "Setup Project" As Template.
3. From The Solution Explorer, Right-click the project and select "Add > File" from the popup menu.



4. Locate your EXE file and Crystal Reports files. This is usually under project\bin\debug or release folder.
5. Right Click the project file and select Properties.
6. Under Build properties, Click Prerequisites button to show the dialog.



7. On the Prerequisites dialog, check Windows Installer 3.1, .NET Framework 3.5 (if your deploying other version, tick other framework listed), Crystal Report Basic for Visual Studio 2008, and Microsoft Visual Studio 2008 Report Viewer. Choose the "Download prerequisites from the same location as my application" to include the installers for the selected prerequisites.



8. Click OK buttons until you close all the property pages.
9. To add Program Menu shortcut, right click your EXE file and click "Create Shortcut" on the context menu. Drag and drop the created shortcut to "User's Program Menu" folder.



10. Click Build > Build Solution to Create the package.
11. Go to your project folder, copy all the files under bin\debug or bin\release to CD or USB.
12. To use it on the target computer, just run the "Setup.exe"

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting :: How to solve "The report you requested requires further information" error message

clock November 3, 2011 14:57 by author Administrator

This issue is a common one who starts working on Crystal Reports with Dataset (.Net)



Ill show a sample code snippet where you can generate this issue.

                
ReportDocument report = new ReportDocument();   
                 BAgent bAgent = new BAgent();
                 DataSet dsStatus = new DataSet();
                 dsStatus = bAgent.GetStatus();

                 string reportPath = Server.MapPath("/Agent/Reports/GetStatusRpt.rpt");                   

                 report.Load(reportPath);
                 report.SetDataSource(dsStatus);// this is the line cause for this issue
                CrystalReportViewer1.ReportSource = report; 
                 CrystalReportViewer1.DataBind(); 
                 CrystalReportViewer1.RefreshReport();


Here is the solution, use the datset table instead of the dataset

                
ReportDocument report = new ReportDocument();   
                 BAgent bAgent = new BAgent();
                 DataSet dsStatus = new DataSet();
                 dsStatus = bAgent.GetStatus();

                 string reportPath = Server.MapPath("/Agent/Reports/GetStatusRpt.rpt"); 
                 report.Load(reportPath);
                 report.SetDataSource(dsStatus.Tables[0]);
                 CrystalReportViewer1.ReportSource = report; 
                 CrystalReportViewer1.DataBind(); 
                 CrystalReportViewer1.RefreshReport();
 

Hope you got rid from this issue. Enjoy coding.

Currently rated 2.8 by 6 people

  • Currently 2.833333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting :: How to Optimize Your Crystal Report for Faster Loading, Paging, and Grouping with ASP.NET

clock November 3, 2011 14:27 by author darwin
We are going to be covering the caching functionality that the Crystal Report framework provides through the ICachedReport interface. What you will learn here:

1. What is the ICachedReport interface.
2. System generated classes and when to modify them.
3. Adding extensions to support ConnetionInfo binding.
4. Putting it all together.

ICachedReport Interface

The ICachedReport interface will work like a flag to signal the Crystal Report framework that the report should be cache. It works by creating a layer ontop of the Asp.net Cache object to accommodate the needs of the report. The interface is found in the CrystalDecisions.ReportSource namespace.

System Generated Classes (Benefits of embedding)

Using Visual Studio to add a report as a new item will generate a report wrapper class with the name of the report. The second class will be the management class named Cached[ReportName]. Visual Studio will generate both classes in the same file (ReportName.cs). Below you will see an example of a generated class for a report called SalesDirectory. For the most part this class will expose everything needed to work with the report without any changes. In some cases when using the Cached class properties will need to be added to support parameters.

namespace Optimized.Reports {

    using System;
    using System.ComponentModel;
    using CrystalDecisions.Shared;


    using CrystalDecisions.ReportSource;
    using CrystalDecisions.CrystalReports.Engine;


    public class SalesDirectory : ReportClass {…} 

[System.Drawing.ToolboxBitmapAttribute(typeof(CrystalDecisions.Shared.ExportOptions),


    "report.bmp")]

    public class CachedSalesDirectory : Component, IcachedReport {…}

}

Extension Methods for Report

What you will often find is that if the report is not properly authenticated, it will prompt the user everytime the report is loaded. What we will do here is leverage the ConnectionInfo object and create an extension method for the Tables inside the report.


using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared; 

namespace
Core.Util
{
    public static class Extensions
    {
        /// <summary>
        /// Set Crystal Report ConnectionInfo.
        /// </summary>
        /// <param name="tables">CrystalDecisions.CrystalReports.Engine.Tables</param>
        public static void SetLocation(this Tables tables)
        {
            ConnectionInfo connectionInfo = new ConnectionInfo();
            connectionInfo.ServerName =                
ConfigurationManager
.AppSettings["CrystalServerName"].ToString();
            connectionInfo.DatabaseName =                ConfigurationManager.AppSettings["CrystalDatabaseName"].ToString();
            connectionInfo.UserID =
                ConfigurationManager.AppSettings["CrystalUserID"].ToString();
            connectionInfo.Password =                ConfigurationManager.AppSettings["CrystalPassword"].ToString();
            connectionInfo.IntegratedSecurity =
                Convert.ToBoolean(                ConfigurationManager.AppSettings["CrystalIntegratedSecurity"]); 

            foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
            {
                TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
                tableLogOnInfo.ConnectionInfo = connectionInfo;
                table.ApplyLogOnInfo(tableLogOnInfo);
            }
       

      }
}

In the example the values are kept in the WebConfig, but it is not a requirement. If the namespace for the Extension class and the pages that have the controls are not the same-it must be added in order for the method to show.

Putting It Together        

Now that we have our SalesDirectory report with the wrapper and utility class, we are going to create a page to hold a report viewer. Below is the code listing for adding the directive to the page and immediately after the declaration for the control.


<%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %> 

<CR:CrystalReportViewer ID="CrystalReportViewer"
                    runat="server"
                    AutoDataBind="true" Visible="true" />

With the report viewer in place the last thing we need to do is create and bind the report to the viewer. We need to cover the difference in how you would setup both approaches so that we can compare performance and also because leveraging the caching management class requires an extra step.

// Without Caching - To be able to compare performance differences.
private void DisplayDirectoryReport()
{
     SalesDirectory directoryReport = new SalesDirectory();
     directoryReport.Database.Tables.SetLocation(); // Set Connection 

     // Set the location for any subreport
     foreach (CrystalDecisions.CrystalReports.Engine.ReportDocument rDocument in
              directoryReport.Subreports)
         rDocument.Database.Tables.SetLocation(); 
     CrystalReportViewer.ReportSource = directoryReport;
     CrystalReportViewer.DataBind();
}

// Implementing the caching management class.
private void DisplayDirectoryReport()
{
     Reports.CachedSalesDirectory cachedSalesDirectory = new
             Reports.CachedSalesDirectory();    

     // Extra step (part of the interface and for the most part will have all the code
     // needed.
     cachedSalesDirectory.CreateReport(); 
     CrystalReportViewer.ReportSource = cachedSalesDirectory;
     CrystalReportViewer.DataBind();

// Inside CachedSalesDirectory code in red is the code that needs to be added.

public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     SalesDirectory rpt = new SalesDirectory();
     rpt.Site = this.Site; 

     rpt.Database.Tables.SetLocation();
     foreach (CrystalDecisions.CrystalReports.Engine.ReportDocument rDocument in
        rpt.Subreports)
        rDocument.Database.Tables.SetLocation(); 

     return rpt;
}

The code listing above covers most cases, but what if the report contains parameters. The last listing is going to show how parameters could be streamlined into the Cached[ReportName] class generated for you. Following the example of the SalesDirectory report, we are going to add two properties to the CachedSalesDirectory class.

[System.Drawing.ToolboxBitmapAttribute(typeof(CrystalDecisions.Shared.ExportOptions), "report.bmp")]
public class CachedSalesDirectory : Component, ICachedReport {       

        public string Counties { get; set; }
        public int StateID { get; set; } 

   …}

Next step is to set the new properties before calling create.

// Implementing the caching management class.
private void DisplayDirectoryReport(string counties, int StateID)
{
     Reports.CachedSalesDirectory cachedSalesDirectory = new
             Reports.CachedSalesDirectory();    

     cachedSalesDirectory.Counties = counties;
     cachedSalesDirectory.StateID = StateID;
     cachedSalesDirectory.CreateReport(); 

     CrystalReportViewer.ReportSource = cachedSalesDirectory;
     CrystalReportViewer.DataBind();
}

Finally we will change the CreateReport function to account for the parameters.

// Inside CachedSalesDirectory code in red is the code that needs to be added.
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
     SalesDirectory rpt = new SalesDirectory();
     rpt.Site = this.Site; 

     rpt.SetParameterValue("@Counties", Counties);
     rpt.SetParameterValue("@StateID", StateID); 

     foreach (CrystalDecisions.CrystalReports.Engine.ReportDocument rDocument in
        rpt.Subreports)
        rDocument.Database.Tables.SetLocation(); 

     return rpt;
}

In conclusion, we have covered a feature of the Crystal Report and .Net framework that allows for faster loading, paging, and grouping of Crystal Report.

Implementing both solutions will prove the efficiency of leveraging the caching functionality.

Need Crystal Report 2008/2010 hosting? We offer both Crystal Report 2008 and 2010 hosting. Please visit our site at http://www.asphostcentral.com.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Cheap Domain Name Registration Service from just $1.99/year with ASPHostCentral.com

clock October 10, 2011 19:15 by author Administrator

Selecting the right domain name for your company is an important part of creating an online presence for your business - your domain name can say so much about you and your company.

1. Just as your company name, there are different ways of coming up with your domain name. If you want your domain name to be the exact name of your business, your first step would be to see if that name is still available.

You can use the ASPHostCentral.com domain search tool to do a query on the domain name, or you can quickly open up your web browser (ie. Internet Explorer, FireFox, Chrome, etc.) and simply type in the domain name into the address bar. See if any website comes up and you'll know if someone else already has it. You can register your domain name from just as low as $1.99/year and that will be the cheapest ever domain name registration service

2. If the domain name is still available, your next step would be to register it. You can do so on ASPHostCentral.com or any other domain registrar's website.

While registering a new domain name with ASPHostCentral.com automatically gives you a free Basic Web Hosting package, do keep in mind that purchasing a domain is not the same as having web hosting. When registering a domain name, you are just purchasing the rights to the name.

ASPHostCentral.com provides complimentary Basic Web Hosting services so you can start using the domain name on a website or email accounts.

If you decide to register your domain with another company, make sure you understand whether web hosting is included or if you have to purchase hosting services separately.

If the domain name is unavailable in the .com extension, you can certainly consider the name in other domain extensions, ie. .net, .biz.

Alternatively, you can definitely consider using your company catchphrase or advertising slogan as your domain name.

Examples:
- Kellogg's owns SnapCracklePop.com as part of their marketing campaign for RiceKrispies.com
- Feelbetter.com is a mirrored site of the painkiller's, Tylenol, main website

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


ASPHostCentral.com - Steps in Changing Web Hosting Providers

clock October 3, 2011 18:45 by author Administrator

There are many reasons why individuals or companies want to change to a new web hosting company. It could be as simple as not enough storage space or bandwidth, or it could be due to its customer service, or lack thereof.

Easier said than done? Changing to a new web hosting company may sound like a daunting task, but it doesn't have to be that complex - there are just a few things to keep in mind.

1. Keep your web hosting account with your existing host open

It is recommend that you keep your existing web hosting account active until you have completed the transition steps (ie. new account setup, file transfer, email creation and setup, DNS modification and propagation).This will ensure that your website and domain email accounts will be running during the transition.

2. Choose a suitable new web hosting provider

Considerations include:

a) Type of OS (Windows vs. Linux) - it depends on the technologies your website requires. For example, if your website requires ASP, MSSQL, MSACCESS or other Microsoft-specific technologies, then you will need to find a Windows-platform web hosting plan.

b) Bandwidth and disk space requirements

3. Make a backup copy of your existing website: download old account files

Ideally, files should be downloaded in the same tree structure in which you want to upload it later. Also look for any file or chmod permissions that you might to set on any folder or file. This is a fairly easy task and can easily be accomplished by FTP.

However, some free web hosting providers do not offer FTP access. This is especially true if you're currently using a free Flash/drag-and-drop website creation service (ie. Weebly.com, WIX.com).

If this is the case, you will not be able to download your existing web files and will have to re-create your new web files. You should check to see if your new web hosting provider offers a free website creator.

To avoid running into the same problem in the future, make sure your new web hosting provider offers FTP access.

4. Setup new (same) email addresses

To ensure that emails are properly received, it is important to keep the same email addresses, including email aliases and forwarders.

5. DNS changes and propagation

Once you have uploaded your web files to the new web hosting server and re-created your email accounts, you can go ahead and make the necessary domain name server (DNS) changes.

DNS is usually obtained once you have signed up with the new web hosting provider. You will need to replace your existing DNS settings with the new one - this is usually done via your domain management panel (your domain registrar).

The new DNS will take anywhere between 24-48 hours to propagate, therefore the old web host is responsible for website and email in the meantime. This is why cancelling the old service should be the very last thing to do.

6. Cancel your old account.

Once your new account has been activated and your website and email services at your new web hosting provider are up and running, you can proceed to have your old account cancelled.



If you need assistance in migrating your website to a new host, you can contact ASPHostCentral.com. We offer migration assistance FREE of CHARGE

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


ASP.NET Hosting :: Things to AVOID in JSON serialization

clock September 12, 2011 16:01 by author Administrator
If you’ve spent much time working with the .NET platform, ASP.NET’s simple, convention-based approach to exposing JSON endpoints seems just about too good to be true. After years of fiddling with manual settings in XML configuration files, it’s understandable to assume that working with JSON in ASP.NET would require a similar rigmarole, yet it does not.Unfortunately, this unexpected ease-of-use isn’t obvious if you don’t already know about it, which has led some developers to build needlessly complicated solutions to problems that don’t actually exist. In this post, I want to point out a few ways not to approach JSON in ASP.NET and then show you a couple examples of leveraging the frame work to do it “right”.

A couple examples of what NOT to do

To show you exactly what I’m talking about, let’s start by looking at a few concrete examples of ways that you should not handle sending and receiving JSON in your ASP.NET services.For all the examples, we’re going to be trying to send and/or receive instances of this Person class:
public class Person
{
  public string FirstName { get; set; }
  public string LastName { get; set; }
}
Once you progress beyond simple scalar types, sending objects (and collections of them) back and forth is a pretty logical next step, and that’s also the point where this manual serialization trouble seems to begin. So, working with this simple Person class should serve as a realistic example, without being overly complex.

Manual serialization, using JavaScriptSerializer

The most common variant of this mistake that I’ve seen is using JavaScriptSerializer to manually build a JSON string and then returning that string as the result of a service method. For example, if you didn’t know better, you might do this to return an instance of the Person class:
[ScriptService]
public class PersonService : WebService
{
  [WebMethod]
  public string GetDave()
  {
    Person dave = new Person();
 
    dave.FirstName = Dave;
    dave.LastName = Ward;
 
    JavaScriptSerializer jss = new JavaScriptSerializer();
 
    // Results in {"FirstName":"Dave","LastName":"Ward"}
    string json = jss.Serialize<Person>(dave);
 
    return json;
  }
}
This may look sensible enough on the surface. After all, the json variable does end up containing a nicely serialized JSON string, which seems to be what we want. However, you should not do this.

What actually happens

Part of the beauty of using ASP.NET’s JSON-enabled services is that you rarely have to think much about the translation between JSON on the client-side and .NET objects on the server-side. When requested with the proper incantations, ASP.NET automatically JSON serializes your service methods’ responses, even if their result is an object or collection of objects.Unfortunately, that automatic translation also makes it easy to end up with doubly-serialized responses if you aren’t aware that ASP.NET is already handling the serialization for you, which is exactly what would happen in the preceding example. The end result is that the Person object is serialized twice before it gets back to the browser – once as part of the method’s imperative code and then a second time by convention.In other words, it’s understandable to expect the previous code example would return this response:
{"FirstName":"Dave","LastName":"Ward"}
But, what it actually returns is this:
// All the quotes in the manually generated JSON must be escaped in 
//  the second pass, hence all the backslashes.
{"d":"{\"FirstName\":\"Dave\",\"LastName\":\"Ward\"}"}
What a mess. That’s probably not what you had in mind, is it?

Using DataContractJsonSerializer or Json.NET is no better

This may seem obvious, but I want to point out that using a different manual serialization tool, like WCF’s DataContractJsonSerializer or Json.NET, in place of JavaScriptSerializer above does not remedy the underlying problem. I only mention it because I’ve seen those variations of the mistake floating around too.If anything, in the case of DataContractJsonSerializer, it’s even worse. DCJS’ handling of Dictionary collections and Enums makes life unnecessarily tedious at times, and the code to manually invoke it is even more verbose than that for JavaScriptSerializer.

The impact this mistake has on the client-side

If it weren’t bad enough to add extra computational overhead on the server-side, cruft up the response with escaping backslashes, and increase the size of the JSON payload over the wire, this mistake carries a penalty on the client-side too.Most JavaScript frameworks automatically deserialize JSON responses, but (rightfully) only expect one level of JSON serialization. That means that the standard functionality provided by most libraries will only unwrap one level of the doubly serialized stack of JSON produced by the previous example.So, even after the response comes back and your framework has deserialized it once, you’ll still need to deserialize it a second time to finally extract a usable JavaScript object if you’ve made the mistake of manually serializing. For example, this is code you might see to mitigate that in jQuery:
$.ajax({
  type: 'POST',
  dataType: 'json',
  contentType: 'application/json',
  url: 'PersonService.asmx/GetDave',
  data: '{}',
  success: function(response) {
    // At this point, response is a *string* containing the
    //  manually generated JSON, and must be deserialized again.
 
    var person;
 
    // This is a very common way of handling
    //  the second round of JSON deserialization:
    person = eval('(' + response + ')');
 
    // You'll also see this approach, which
    //  uses browser-native JSON handling:
    person = JSON.parse(response);
 
    // Using a framework's built-in helper 
    //  method is another common fix:
    person = $.parseJSON(person);
  }
});
Regardless of which approach is used, if you see code like this running after the framework has already processed a response, it’s a pretty good indication that something is wrong. Not only is this more complicated and verbose than it needs to be, but it adds additional overhead on the client-side for absolutely no valid reason.

Flipping the script (and the JSON)

Redundant JSON serialization on responses is definitely one of the most common variations of this problem I’ve seen, but the inverse of that mistake also seems to be an alluring pitfall. Far too often, I’ve seen service methods that accept a single JSON string as their input parameter and then manually parse several intended inputs from that.Something like this to accept a Person object form the client-side and save it on the server-side, for example:
[ScriptService]
public class PersonService : WebService
{
  [WebMethod]
  public void SavePerson(string PersonToSave)
  {
    JavaScriptSerializer jss = new JavaScriptSerializer();
 
    Person p = jss.Deserialize<Person>(PersonToSave);
 
    p.Save();
  }
}
Just as ASP.NET automatically JSON serializes responses on its JSON-friendly services, it also expects that the input parameters will be in JSON format and automatically deserializes those on the way in. So, in reverse order, the approach above makes a mistake similar to the ones shown earlier.To make this work, we’d need to pass in JSON that looks something like this, obfuscating the actually desired input parameters inside a single, doubly-serialized string parameter.
{"PersonToSave":"{\"FirstName\":\"Dave\",\"LastName\":\"Ward\"}"}
Through the convenience of JSON.stringify(), it’s not even terribly hard to stumble onto a process for cobbling that double-JSON structure together on the client-side and making this approach work. I strongly recommend against it though. Even if the double-JSON didn’t carry extra overhead in several aspects, having a single input parameter of type string on this method is misleading. A year from now, will anyone realize what type of parameter that method accepts without looking down into the manual parsing code? Probably not.

Doing it right

Briefly, here are what I suggest as better ways to handle passing our Person object in and out of ASP.NET services.

Returning an object

Returning a .NET object from ASP.NET services is incredibly easy. If you let go and just trust the service to handle JSON translation for you, “it just works”:
[ScriptService]
public class PersonService : WebService
{
  [WebMethod]
  public Person GetDave()
  {
    Person dave = new Person();
 
    dave.FirstName = Dave;
    dave.LastName = Ward;
 
    // So easy!
    return dave;
  }
}
As long as you call that service method through a ScriptManager’s service proxy or using the correct parameters when using a library like jQuery, ASP.NET will automatically serialize the Person object and return it as raw, unencumbered JSON.

Accepting an object from the client-side

Accepting a Person object from the client-side works identically, in reverse. ASP.NET does a great job of matching JSON-serialized request parameters to .NET’s types, collections, and even your own custom objects.For example this is how you could accept a Person object, which would even then allow you to call that object’s custom methods:
[ScriptService]
public class PersonService : WebService
{
  [WebMethod]
  public void SavePerson(Person PersonToSave)
  {
    // No, really, that's it (assuming Person has a Save() method).
    PersonToSave.Save();
  }
}
 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting :: Dynamic Images at runtime in Crystal Report XI using ASP.Net 2.0

clock June 9, 2011 17:46 by author Administrator

This article helps to display dynamic Images in crystal report Using ASP.Net 2.0.

We can use two methods to dynamically change the picture in the crystal report either the Image stored in the database as a BLOB and as a picture available in the local path.

Method I: Using recordset

1. Add a recordset and add a table in that. Add a column of System.Byte[] (Only System.Byte is available in the data type of data Table, Manually add the System.Byte[] in that. System.Byte not allowed for images).Then use the below code

2. Design the report with that dataset. You can add this System.Byte[] column as part of your main data table which have the all data or add a separate data table with a System.Byte[] and a key column that link to the main data table.

3. Add the below code

private ds_Images Images1;
rptTest crReportDocument = new rptTest(); // rptTest is your crystal report name

protected void btnShowReport_Click(object sender, EventArgs e)
{
ImageTable(); crReportDocument.Database.Tables["tblImages"].SetDataSource(Images1.Tables[0].DataSet);
string ExportPathFinal;
ExportPathFinal = ExportPath + "\\" + "TEMP" + "\\";
if (Directory.Exists(ExportPathFinal) == false) Directory.CreateDirectory(ExportPathFinal);

//Export Crystal Report to PDF
ExportOptions crExportOptions = new ExportOptions();
DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions();
crExportOptions = crReportDocument.ExportOptions;
crDiskFileDestinationOptions.DiskFileName = ExportPathFinal + "MyreportTest.pdf";

//Set the required report ExportOptions properties
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; // Or any other Format
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crReportDocument.Export();

string ExportPathFinal1 = ExportPath1 + "\\" + "TEMP" + "\\";
string pathToPDFfile = ExportPathFinal1 + "MyreportTest.pdf";
Response.Redirect(pathToPDFfile, true);
//Close and dispose of report
crReportDocument.Close();
crReportDocument.Dispose();
GC.Collect();
}

private void ImageTable()
{
ds_Images Images1 = new ds_Images();
string fileName = @"\\img\a.JPG";
fileName = Server.MapPath(fileName.Trim());
DataRow row;
Images1.Tables[0].TableName = "tblImages";
Images1.Tables[0].Columns.Clear();
Images1.Tables[0].Columns.Add("img", System.Type.GetType("System.Byte[]"));
row = Images1.Tables[0].NewRow();
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
row[0] = br.ReadBytes(Convert.ToInt32(br.BaseStream.Length));
row[1] = 1;
Images1.Tables[0].Rows.Add(row);
br = null;
fs.Close();
fs = null;
}

Method II: Using Picture Object of Crystal Report

Using the Dynamic Graphic Location of picture OLE object of crystal report, we can change picture dynamically at run-time.

1. Create a parameter field in the report with string data type.
2 In the report Add a picture OLE object. inside report right click->Insert->OLE object- >select Bitmap Image
3 Right click the OLE picture object and select Format Object- >select Picture tab ->Graphic location -> inside it drag the parameter field.

in the front end just pass the Image URL to the report

ParameterDiscreteValue crParameterimgLocation;
string img_url = @"\\images/newImages/nevadadot.JPG";
img_url = Server.MapPath(img_url);
crParameterField = crParameterFields["imgLocation"];
crParameterValues = crParameterField.CurrentValues;
this.crParameterimgLocation = new ParameterDiscreteValue();
this.crParameterimgLocation.Value = img_url;

//Add current value for the parameter field
crParameterValues.Add(crParameterimgLocation);

Note: while passing the Image URL do not put put single quotes.

We can use either method to display the Images in the report dynamically.

In Crystal Reports XI, the 'Dynamic Image Location' feature does not work with images in GIF format. Why does this behavior occur and how can you resolve it?" This drawback matches to the recordset method too.

"To debug the issue

This behavior occurs because Crystal Reports XI does not fully support the GIF file format. To resolve this behavior, use a supported image format when working with the 'Dynamic Image Location' feature. Supported image formats are Joint Photographic Experts (JPG), bitmap (BMP), Tagged Image File Format (TIF) and Portable Network Graphics (PNG)."

Any comments appreciated

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Crystal Report Hosting

ASPHostCentral is a premier web hosting company where you will find low cost and reliable web hosting.

Sign in