Monday, June 17, 2013

Uninstall IE10 and Get back to IE9 on Windows 7

Ever since I've installed IE10, I have been experiencing issues when it comes to debugging my program. Oftentimes, IE10 crashes. So, I've just decided to uninstall it.

Here's the process:

1. Click on the “Start” button and type “Programs and Features” in the search box.

2. Click on the “View installed updates” in the left pane of the menu.

3. Go over to the “Uninstall an update” screen and scroll down to the “Microsoft Windows” section. Simply select Internet Explorer 10 and click “Uninstall.”

4. Wait until the updates are uninstalled then reboot.

via SoftPedia

Saturday, June 15, 2013

Restore Database Failed: Exclusive access could not be obtained because the database is in use

Solution 1: Set to single user, then restore
Alter Database [<Database Name>]
  SET SINGLE_USER With ROLLBACK IMMEDIATE

RESTORE DATABASE [<Database Name>] FROM  DISK = N'E:\Databases\SampleDatabase.bak' WITH  FILE = 1,  MOVE N'Tfs_Silverlight' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\SampleDatabase.mdf',  MOVE N'SampleDatabase_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\SampleDatabase.LDF',  NOUNLOAD,  REPLACE,  STATS = 10
GO

Solution 2: Restart SQL Server service
1. Start -> Run and type in services.msc
2. Right click on the SQL Server instance (MSSQLSERVER), click Stop and then Start the service
3. Do the restore process

Thursday, June 13, 2013

SQL Server 2008: Saving Changes is not permitted

Scenario:
When you use Data Definition Language (DDL) to modify a table, and then you try to save the table in Microsoft SQL Server 2008, you may receive the following message:

Error:
Saving changes is not permitted. The changes that you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require the table to be re-created.

Solution:
1. Go to: Tools > Options

2. Select the tab Designers and choose Tables and designers

3. Uncheck the option: "Prevent saving changes that require table re-creation".

4. Save, of course!

Thursday, June 6, 2013

No column header when exporting to CSV from Telerik Report

Check the config file. Make sure that the NoHeader attribute is set to "false"
<Telerik.Reporting>
<Extensions>
<Render>
<Extension name="CSV">
<Parameters>
<Parameter name="NoHeader" value="false"/>
<Parameter name="NoStaticText" value="true"/>
</Parameters>
</Extension>
</Render>
</Extensions>
</Telerik.Reporting>


What if you see the textboxes names and you don't want it of course?

namespace ClassLibrary3
{
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;
    using Telerik.Reporting;
    using Telerik.Reporting.Drawing;

    /// <summary>
    /// Summary description for Report1.
    /// </summary>
    public partial class Report1 : Telerik.Reporting.Report
    {
        public Report1()
        {
            /// <summary>
            /// Required for telerik Reporting designer support
            /// </summary>
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            this.textBox1.Name = "Text Box 1";
            this.textBox2.Name = "Text Box 2";
            this.textBox3.Name = "Text-Box-3";

        }
    }
}


Set the textboxes names according to your desired column header names.

Saturday, June 1, 2013

Telerik Report export to CSV has extra columns and headers of control names

Solution:
Configure the CSV rendering extension

Implementation:
By default the CSV rendering extension generates plain text files, without any formatting, and the first row contains the headers for all columns (you may choose whether to have this header row or not).

In Telerik Reporting, device information settings are used to pass rendering parameters to a rendering extension. You can specify device information settings in a variety of ways. You can use the <Telerik.Reporting> configuration section to specify rendering parameters globally. Programmatically, you can use the ReportProcessor.RenderReport() method. For more information about specifying rendering parameters globally, see Configuring Telerik Reporting.

The example below shows a sample application configuration file (App.config or Web.config depending on whether it is a Windows Forms or ASP.NET application) in which we modify the original CSV rendering extension settings to generate a CSV file without the header row (NoHeader = True) and all TextBox items that contain static text (not an expression) skipped (NoStaticText = True):
 
<?xml version="1.0"?> 
<configuration> 
  <!-- The configSectins element should be the first child element of configuration --> 
  <configSections> 
   <!-- Substitute Version=X.X.X.X with the assembly version you are using! --> 
   <section 
      name="Telerik.Reporting" 
      type="Telerik.Reporting.Processing.Config.ReportingConfigurationSection, Telerik.Reporting, Version=X.X.X.X, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" 
      allowLocation="true" 
      allowDefinition="Everywhere"/> 
  </configSections> 
       
  <Telerik.Reporting> 
    <Extensions> 
      <Render> 
        <Extension name="CSV"
          <Parameters> 
            <Parameter name="NoHeader" value="true"/> 
            <Parameter name="NoStaticText" value="true"/> 
          </Parameters> 
        </Extension> 
      </Render> 
    </Extensions> 
  </Telerik.Reporting> 
</configuration> 

If the report exported with default settings looked like this:

addressIDCaptionTextBox1,cityCaptionTextBox1,postalCodeCaptionTextBox1,textBox1,cityDataTextBox,postalCodeDataTextBox  
AddressID,City,PostalCode,20,Bothell,98011  
AddressID,City,PostalCode,21,Bothell,98011  
AddressID,City,PostalCode,22,Portland,97205  
AddressID,City,PostalCode,23,Seattle,98104  
AddressID,City,PostalCode,24,Duluth,55802  
AddressID,City,PostalCode,25,Dallas,75201  
AddressID,City,PostalCode,26,San Francisco,94109  
AddressID,City,PostalCode,27,Nevada,84407  
AddressID,City,PostalCode,28,Phoenix,85004  
AddressID,City,PostalCode,29,Memphis,38103  
AddressID,City,PostalCode,30,Orlando,32804  
AddressID,City,PostalCode,31,Ottawa,K4B 1T7  
AddressID,City,PostalCode,32,Montreal,H1Y 2H5 

With the given device information you will get:

20,Bothell,98011  
21,Bothell,98011  
22,Portland,97205  
23,Seattle,98104  
24,Duluth,55802  
25,Dallas,75201  
26,San Francisco,94109  
27,Nevada,84407  
28,Phoenix,85004  
29,Memphis,38103  
30,Orlando,32804  
31,Ottawa,K4B 1T7  
32,Montreal,H1Y 2H5  

Source: Configuring the CSV Rendering Extension