Free Asp.Net,MVC,AngularJs,Jquery,Javascript,Sql Server,WCF,Entity framework snippets and tutorial

Read XML file and display data using asp.net MVC

In this article I am going to explain how to read XML file and display data using asp.net MVC.


Description:
I have XML of student detail. I want to read this file and display its data.

Export table to Excel file using Angularjs in asp.net MVC

In this article I am going to explain how to export table to Excel file using Angularjs in asp.net MVC.


Description:
When I am working on project I have got a requirement to export the table to excel file. I have got a simple solution to fulfill this requirement. I have found FileSaver.js.
[Solved]: XML parsing: unrecognized encoding

[Solved]: XML parsing: unrecognized encoding

In this article I am going to explain how to solve the XML parsing: line 1, character 39, unrecognized encoding error.

Description:
When I am working on XML file I have got an error “XML parsing: line 1, character 39, unrecognized encoding” in asp.net.

Solution:
This error is occurred because of encoding issue. SQL Server expects the XML file should be UTF-16. We have to change the encoding from utf-1, utf-8 to utf-16.

Draw Stacked column chart using Google chart API in asp.net MVC

In this article I am going to explain how to create stacked and multi series column chart using Google chart API in asp.net MVC.


Description:
I want to draw a chart to show how many male and female in Indian states. We have two approaches to draw chart. First we can create multi series chart and second can draw stacked chart.

Implementation:
I have created a table Tb_Statewisepopulation and insert dummy data into it.

Stateid
int
StateName
varchar(100)
Male
int
Female
int

I am using data first approach in MVC application.
Sql server : Show 0 instead of null value

Sql server : Show 0 instead of null value

In this article I am going to explain how to show 0 instead of null value in sql server.


Description:
We have three alternatives to show 0 instead of null value in Sql.

Sql server : COALESCE function with example

Here in this article I am going to explain COALESCE function of sql server with example.

Description:
The COALESCE function takes comma separated list of arguments of same data type sbut returns the value of the first non-NULL argument.

Syntax:
COALESCE( expression1,[....n] )

CASE expression in Sql Server

In this article I am going to explain about Sql Server’s CASE expression.

Description:
Case statement is also known as CASE expression. We can use CASE expression anywhere in Sql query. It can be used with in select, where clauses, Order by clause, HAVING clauses, insert, update and delete statements.

Sql server: Get difference in Day, Hour, Minute and second between two dates

In this article I am going to explain how to find difference between two dates in day, hour, minute and second using sql server.

Implementation:
I want to get difference of two dates in days, hour, minutes and second. To get difference I have use datediff function of sql.

[Solved ]:A network-related or instance-specific error occurred while establishing a connection to SQL Server

How to resolve “a network-related or instance-specific error occurred while establishing a connection to SQL Server” error.

Description:
While I am working on window application I have received the error:


“A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: shared memory provider, error:40 could not open a connection. to sql server)”
How to concatenate strings in sql server

How to concatenate strings in sql server

In this article I am going to explain how to concatenate strings in sql server.

Description:
Earlier we use concatenate strings in Sql server using + symbol. But now sql server introduces the CONCAT function in 2012.

Syntax of + symbol
Select column1+column2 from tablename

Syntax of concat function
Select concat(column1,column2)from tablename

Check Case-Sensitivity in SQL Server

In this article I am going to explain how to Check Case-Sensitivity in SQL Server.


Description:
SQL server determines case sensitivity by collation. COLLATE is the T-SQL clause used to specify a particular collation for an expression. We can use this to validate the users enter password at the time of login.
Sql server: Encrypt store procedure, view and function

Sql server: Encrypt store procedure, view and function

In this article I am going to explain how to Encrypt store procedure, view and function in sql server.


Description:
We write most of logic in Store procedures. Sometime due to security reason we have to hide the logic from end users. Keyword With encryption is used to encrypt the text/logic of store procedure, view and function.
How to take database Backup and restore using command T-Sql

How to take database Backup and restore using command T-Sql

In this article I am going to explain how to take database Backup and restore using command T-Sql.


Description:
We have only 2 commands for database backup, backup database and backup log. Backup database takes backs up the full database and backup log backs up transaction log.

Backup database
Backup database [demo] to disk='D:\demo.bak'

Backup log
backup log [demo] to disk='D:\demolog.bak'

Restore database
restore database [demo] from disk='D:\demo.bak'