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

Create text file and download using asp.net

In this article I am going to explain how to create text file and download using asp.net


Implementation:
I want to create text file and download it on button click. I have created example to fulfill this requirement.

Create column chart in asp.net

In this article I am going to explain how to create column chart using Chart control in asp.net.

  
Implementation:
I am using chart control to draw column chart.
I have created a table Tb_Population and insert some dummy data.

Id
int
StateName
varchar(200)
TotalPopulation
bigint

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