Sunday, July 7, 2013

How to restart a server from MSSQL SERVER using xp_cmdshell

Sometimes we need to restart a windows PC or server within or after an interval of time. We can do it easily using 'scheduled task' of windows. Here I‘ll discuss how to do this task from MS SQL SERVER. To do this we'll use a stored procedure ‘xp_cmdshell’ and an ms-dos command ‘shutdown’. “xp_cmdshell” is a stored procedure which allows us to execute ms-dos commands from SQL Server. Syntax xp_cmdshell {'command_string'} [, no_output] Arguments command_string:...
Read More

Wednesday, July 3, 2013

Some new structural tags in HTML5

Before HTML5, <div> elements were the only opportunity for defining block-level page structure. HTML5 introduced us with few important structural elements: header, footer, nav, article, section, aside and hgroup.  The new elements simply give us an element that carries more meaning, with which to replace the generic <div>. Header: Header element is designed for the header area of a page or page section. The header element...
Read More

Thursday, June 27, 2013

Audio and Video in HTML5

<audio> and <video> tags of HTML5 allows us to incorporate native audio and video support without Flash. To include audio and video we need to set src attribute to identify the media source and include a controls attribute so the user can play and pause the media. The simplest way of embedding a video file in a webpage: <video src="video.mp4" width="320" height="200" controls preload></video> <audio src="audio.mp3" controls preload></audio> We can use <source> tag to indicate media along...
Read More

Saturday, June 15, 2013

MSSQL Database Backup

Database backup is a very important thing if you don’t want to drop any of your valuable data that you are storing. Here, I’ll explain how to create MSSQL database backup. Step-1: Create a stored procedure from following script. CREATE procedure prcDBBackup as declare @dbname varchar(100) select @dbname = CONVERT(VARCHAR(10),GETDATE(),101)+CONVERT(VARCHAR(8),GETDATE(),108) select @dbname = replace(replace(@dbname,'/',''),':','') set @dbname = (select'E:\ERP_DB_BACKUP\ERP_DB_' + @dbname + '.BAK') BACKUP DATABASE ERP TO DISK = @dbname Replace...
Read More

Thursday, May 23, 2013

How to access an Existing Database Using Entity Framework 5.0 Code-First

In my previous two articles we see how to use Entity Framework Code First and mvcscaffolding in asp.net mvc4. We didn't create any database into above articles. Database was created automatically from model class. But in this article I’ll explain how to use existing database in an EF code-first application. For this purpose we’ll make two small changes in any asp.net mvc code-first project. 1. Define connectionstring in web.config for existing database. <connectionStrings>     <add name="DonarConnectionString"...
Read More

Monday, April 29, 2013

Asp.net MVC Scaffolding in code first scenarios

In this article we will walk through the creation of a read/write/update/delete of Recipes and its related (many) Ingredients using MvcScaffolding and MVC 4. MVC Scaffolding gives you a fast way to get some helpful, effective code, that you can then edit and adapt according to your needs. In other words, MvcScaffolding  can create automatically: 1. Controllers for creating, viewing, updating and deleting instances of your model, 2. Corresponding Views for creating, viewing, updating, and deleting data, 3. Database contexts from...
Read More

Wednesday, April 24, 2013

Create an application using asp.net MVC 4 and EF code first

In this tutorial we will create our first MVC application using visual studio 2012, MVC 4 and EntityFramework Code First. Step-1: Create Project 1. In Visual Studio 2012, add a new project by selecting the File menu, then New and then Project. 2. Select ASP.NET MVC 4 Web Application and C# as a language of choice. 3. Name the project Inventory and then click OK. 4. In the New ASP.NET MVC 4 Project wizard, choose Internet Application and razor view engine. 5. Leave the default values of the other options and click OK. Step-2: Create...
Read More

Monday, April 22, 2013

MS SQL Server Job

A SQL  Job is a collection of steps executed by the database engine by SQL ServerAgent. The job can perform many different functions within it that can save time and effort on the part of employees. Let us consider a procedure PrcDailyUpdateForecast which will be executing hourly. Minimally, it takes two or three steps to set up a scheduled task to execute the code of your choice. First, go to the Management node, SQL Server Agent,...
Read More

Saturday, April 20, 2013

SQL Cursor

SQL Server is very good at handling sets of data. For example, you can use a single UPDATE statement to update many rows of data. There are times when you want to loop through a series of rows a perform processing for each row. In this case you can use a cursor. The basic syntax of a cursor is: Declare @vStyleID varchar(50) Declare @Qty numeric set @Qty = 0 DECLARE CurClosing CURSOR FOR select DISTINCT vStyleID from tmprptstylewiseclosingreport OPEN...
Read More

Wednesday, April 17, 2013

Introduction to MVC Concepts

The intension of MVC or Model-View-Controller is to build applications in a modular way. In MVC, 3 general parts/layers are responsible for creating the output and allowing the interaction with the user: 1.Model 2.View 3.Controller Model: In the context of the MVC the model has the data that is essential to render things in the view. So it represents the data that are mandatory for rendering. It also takes over the process related...
Read More