Surendra Sharma

Surendra Sharma

Search This Blog

Monday, January 27, 2014

Creating a Scheduled Database Backup Plan using SQL Agent Jobs


This article explained that how to automate database backup process using SQL Agent Jobs

Step 1: GOTO the machine on which SQL Server is installed.


Step 2: Connect to the SQL server using SQL Server Management Studio. You need administrative access so use Windows credentials or the SA account

Step 3: Expand the Management section from the Object Explorer pane and right click on the Maintenance Plans


Step 4: Right-click on Maintenance Plans and choose New Maintenance Plan. Provide a valid name and click OK


Step 5: Double click on Subplan_1
Name: A simple name for the section of the plan (e.g. Backup)
Description: Provide some more detail explanation (e.g. Takes a daily backup and deletes the one created the previous day)

Step 6: Click on the calendar icon next to the Schedule field. Change the frequency according to requirement.


Step 7: On the left-hand (Below the Object Explorer) there will be a toolbox containing call the available tasks

 

Step 8: Add a Back Up Database Task. You can either double click it, or drag and drop it into the beige field


Step 9: Double click on the Icon to set up the backup specifications


Step 10: Specify the databases to back up. You can click on “All user databases“, or select specific ones using the “These Databases” option.

Click OK

Select the Create a backup file for every database option

Check the box that says “Create a sub-directory for each database

Select a location for the backup files.


Hit OK

Please leave your comments or share this tip if it’s useful for you.

Tuesday, January 21, 2014

JavaScript error Unable to get Value of the property 'length': object is null or undefined.

If your website is working fine but some user getting JavaScript error as “Unable to get Value of the property 'length': object is null or undefined.” Then problem is with their browser cache.

Delete browser complete history by uncheck “Preserve Favorites website data” and select rest of option as shown below as shown below





Please leave your comments or share this tip if it’s useful for you.

Monday, January 20, 2014

Tech tip for TFS error “TF203015: The item has an incompatible pending change”

If you are getting TFS error “TF203015: The item has an incompatible pending change” then follow below guidelines to fix it.

·         Un-shelve whatever you have shelve
·         While you are branching, as shown in below figure, browse your release folder and write “/V1.1” manually. Don’t create folder “V1.1” in “ReleaseFolder”, let Visual studio make it for you while branching.
·         Uncheck both the checkboxes.
·         Click on OK.




Please leave your comments or share this tip if it’s useful for you.

Thursday, January 16, 2014

“Alias is not unique error” in Sybase IQ

If you are executing SELECT statement in Sybase IQ with having same alias name of two columns as below

SELECT
      School.cCreatedBy AS CreatedBy,
      Student.cCreatedBy AS CreatedBy,
      Student.FullName AS FullName
FROM
      School INNER JOIN Student
ON
      School.ID = Student.SchoolID

then you will get error “Alias 'CreatedBy' is not unique”.

However same query run in SQL Server without any problem.

To fix this just remove alias or change alias name of any one column as below

SELECT
      School.cCreatedBy,
      Student.cCreatedBy,
      Student.FullName AS FullName
FROM
      School INNER JOIN Student
ON
      School.ID = Student.SchoolID

OR

SELECT
      School.cCreatedBy AS SchoolCreatedBy,
      Student.cCreatedBy AS CreatedBy,
      Student.FullName AS FullName
FROM
      School INNER JOIN Student
ON
      School.ID = Student.SchoolID



Please leave your comments or share this tip if it’s useful for you.

Wednesday, January 15, 2014

503 Service Unavailable for reports area of an ASP.NET MVC application


Recently I come across to strange problem where all hyperlinks are working fine in ASP.NET MVC based project except link “Reports”.  

Whenever user clicks on “Reports” link, browser shows “HTTP Error 503. The service is unavailable”.

Developers are not able to debug it. Fiddler also not showing any HTTP request / response details.

Solution:

When I analyze problem, I noted that complete URL of link “Reports” is http://abcd.com/Reports

I googled this issue then come to know that it was due to SQL Reporting services having reserved the link “Reports” for http://+:80/Reports url in http.sys.

If SQL server reporting services are installed on your machine then just try to access “http://localhost/Reports” from browser. You should get SQL Server Reporting Services Home page.

Here is the solution
·         Either changed the URL from having name Reports to some new name
·         Or try following command
netsh http delete urlacl url=http://+:80/Reports



 Please leave your comments or share this tip if it’s useful for you.

Thursday, August 29, 2013

How to show different type of documents in ASP.NET webpage

To view different type of file, particular software is required.

Suppose if your website have word documents, client must have MS-Office software to view it. Similarly to show PDF, Adobe Acrobat is required.

In this way there can be thousands type of file format, will you install all these software to view particular type of file?

Problem. Very serious problem.

How nice if I use only one tool and can view any file as below




What is the solution?

Use online document viewer.

The beauty of online viewer is that no need to purchase different type of software on Web Server or client side.
You don't need to upload your file to their server.

The one online document viewer that I like is http://www.prizmcloud.com/

They allow to embed document viewing in your site, blog or social media. They supports  300+ file types, play self-running slideshows, all while keeping them on your server and in your control and no installation required.

It also supports various online features like zoom , print, navigate, copy , save , fill screen, search etc.

How to use it?

First register free yourself on http://www.prizmcloud.com/register.html.

After successful registration you will receive your KEY.

Now we can use their service by passing KEY and document URL as a query string to their cloud server at http://connect.ajaxdocumentviewer.com.

Example 1 :- Use below URL with query string as below



Where
·         key = Your key number
·         document = Any valid URL of document

Other supported optional query strings are

·         viewertype = flash or HTML5
·         viewerheight = viewer height in pixel
·         viewerwidth = viewer width in pixel
·         printButton = Yes or No
·         toolbarColor = colour code like CCCCCC



How to use it in ASP.NET webpage?

Use frame tags in your ASP.NET page like

<iframe width="700" height="650" src="http://connect.ajaxdocumentviewer.com/?key=123456789&document=http://www.cdc.gov/phpr/documents/11_225700_A_Zombie_Final.pdf">
</iframe>
         
Use below ASPX code for displaying PDF file in document viewer as shown in above image

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <iframe width="700" height="650" src="http://connect.ajaxdocumentviewer.com/?key=123456789&viewertype=flash&document=http://www.cdc.gov/phpr/documents/11_225700_A_Zombie_Final.pdf&printButton=Yes&toolbarColor=CCCCCC">
            <p>Your browser does not support frames.</p>
        </iframe>
    </div>
    </form>
</body>
</html>


Please leave your comments or share this tip if it’s useful for you.

Wednesday, August 28, 2013

How to open ASP.NET web page in Print mode

I have requirement where user clicked on link in Main page should open another window with view only information. This view only window should be directly open in PRINT mode as below



This can be achieve by using Javascript functions.

Below ASPX page directly opened in Print mode

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Open Page in Print Mode</title>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            //Allow page to be load so keep delay of 1 sec and show the print dialogue
            setTimeout(printWindowAfterDelay, 1000);
        });

        function printWindowAfterDelay() {
            window.print();
        }

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <div>
            <h1 align="left">
                Open page in print mode</h1>
        </div>
        <div>
            Put your controls here
        </div>
    </div>
    </form>
</body>
</html>


Please leave your comments or share this tip if it’s useful for you.