Friday, September 25, 2015

Asp.net: Import MS Excel sheet records into Sql server database

In this tutorial I am going to explain how to import the MS Excel sheet records into Sql server database in asp.net

Description:

I have a MS excel file which have records/details of employees. I want to import all records from excel file into database table.


Implementation:
I have a table in Tb_Employee

Thursday, September 24, 2015

Asp.net: change the text color in Image dynamically

In this article today I am going to explain how to change the text color in Image in Asp.net.

Description:
Asp.net: change the text color in Image dynamically


To change the text color in image I have use the transparent image. In this example I have keep the transparent image in images folder. On button click to change color I have create a new image and save to image folder.




Implementation:
HTML Markup:
  <table>
    <tr>
   <td colspan="2">
        <asp:Image ID="Image1" runat="server" ImageUrl="images/n.png" /></td>
    </tr>
    <tr>
    <td><asp:Button ID="Button1" runat="server" Text="Green" /></td><td><asp:Button ID="btnred"
            runat="server" Text="Red" /></td>
    </tr>
    </table>

Add the Namespace

Sunday, September 20, 2015

Asp.net: Different ways to disable auto-fill in browser for a textbox

In this article I am going to explain different ways to disable auto-fill for a textbox in asp.net

Description:

All major browsers (Google chrome, Mozilla firefox, Safari and Internet explorer) has default functionality of auto complete the textboxes values means when user start to type value in textbox gets a dropdown like prefilled values in that particular textbox . We can disable the auto fill settings of browsers by uncheck the enable autofill option in browsers settings.

Asp.net: Different ways to disable auto-fill in browser for a textbox


Saturday, September 19, 2015

ASP.Net: Insert multiple records (rows) into sql server database

In this article I am going to explain how to insert multiple records (rows) into sql server database using Asp.net

Description:

I have created a table Tb_Movies and want to insert multiple records into it. 

ASP.Net: Insert multiple records (rows) into sql server database

User click on add new row button (user can add multiple rows to Gridview) it will add row to Gridview data control.

Tuesday, September 15, 2015

Asp.net add multiple rows to Gridview dynamically

In this article I am going to explain how to add multiple rows to Gridview control dynamically in asp.net

Description:

In this article I am going to add the multiple rows to Gridview on button click.

Implementation:
Method 1:
In this method when user clicks on button it continually added the row to Gridview control.

Sunday, September 13, 2015

Asp.net: Fill Country, State and City dropdownlist

In this article today I am going to explain How to populate the Country, State and City dropdownlist in asp.net

Description:

I want to populate the state dropdown on Country dropdown selection and city dropdown on state dropdown selection. I have created three tables.

Country:
Fill Country, State and City dropdownlist

State:
Fill Country, State and City dropdownlist
City:

Fill Country, State and City dropdownlist

Implementation:
Add a webform to project/website. drag and drop the required control from toolbox to webform.

Friday, September 11, 2015

Top 20 Sql server Interview questions with answer on Select statement

Sql server Select statement Interview question and answers

I have created a table name EMPLOYEE_INFORMATION.

EMPLOYEE_ID
int
EMPLOYEE_NAME
varchar(50)
EMPLOYEE_SALARY
int
EMPLOYEE_DEPARTMENT
varchar(50)

Table contain the below mention data as in snapshot: 



To Display all the Details from EMPLOYEE_INFORMATION:
SELECT * FROM dbo.EMPLOYEE_INFORMATION

To Display the information and manage in Descending order on Salary wise:
SELECT * FROM dbo.EMPLOYEE_INFORMATION ORDER BY EMPLOYEE_SALARY DESC

To Display the information and manage in Asecnding order on Salary wise:
SELECT * FROM dbo.EMPLOYEE_INFORMATION ORDER BY EMPLOYEE_SALARY ASC

To display the Employee name and Department from Table:
SELECT EMPLOYEE_NAME,EMPLOYEE_DEPARTMENT FROM dbo.EMPLOYEE_INFORMATION

To display Total Salary being paid to all Employee:
SELECT SUM(EMPLOYEE_SALARY) FROM dbo.EMPLOYEE_INFORMATION

To display Highest Salary being Paid to in Department(HR):
SELECT MAX(EMPLOYEE_SALARY) FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_DEPARTMENT='HR'

To display Lowest Salary being Paid to in Department(HR):
SELECT MIN(EMPLOYEE_SALARY) FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_DEPARTMENT='HR'

To display the Employee Name who works in WEB DEVELOPER Department:
SELECT EMPLOYEE_NAME FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_DEPARTMENT='WEB DEVELOPER'

To Display the Employee name who not works in WEB DEVELOPER Department:
SELECT EMPLOYEE_NAME FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_DEPARTMENT NOT IN ('WEB DEVELOPER')

To find the Highest Salary of Employee:
SELECT MAX(EMPLOYEE_SALARY) FROM dbo.EMPLOYEE_INFORMATION

To find the Minimum Salary of Employee:
SELECT MIN(EMPLOYEE_SALARY) FROM dbo.EMPLOYEE_INFORMATION

To Display the Employee Name and Salary between the Range:
SELECT EMPLOYEE_NAME,EMPLOYEE_SALARY FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_SALARY BETWEEN 7000 AND 9000

To Display top 5 Records of Table:
SELECT TOP 5 EMPLOYEE_SALARY FROM dbo.EMPLOYEE_INFORMATION

To Count the number of Rows:
SELECT COUNT(*) FROM dbo.EMPLOYEE_INFORMATION

To Find the Employee Name Starts with ALPHABET ‘V’:
SELECT * FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_NAME LIKE 'v%'

To Find the Employee Name where Second ALPHABET is ‘I’:
SELECT * FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_NAME LIKE '_I%'

To Find the Employee Name End with ALPHABET ‘Y’:
SELECT * FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_NAME LIKE '%Y'

To display Employee Name whose Salary is GRETAER than ‘9000’ and work in Department ‘WEB DEVELOPER’:
SELECT EMPLOYEE_NAME FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_DEPARTMENT='WEB DEVELOPER' AND EMPLOYEE_SALARY>9000

To display Employee Name whose Salary is LESS than 9000 and work in Department ‘WEB DEVELOPER’: 
SELECT EMPLOYEE_NAME FROM dbo.EMPLOYEE_INFORMATION WHERE EMPLOYEE_DEPARTMENT='WEB DEVELOPER' AND EMPLOYEE_SALARY<9000



Thursday, September 10, 2015

ADO.Net entity framework CRUD function using store procedure in Gridview

In this article I am going to share how we can do CRUD (Create, Read, Update and Delete) operations in Gridview using ADO.Net Entity Framework

Description:

Create a table movie. I am going to insert, edit, update and delete the record into table using  Gridview.
ADO.Net entity framework CRUD function using store procedure in Gridview


Implementation:
First of all create store procedure to Insert, update, Select and delete the record.

Monday, September 7, 2015

Sql server: Local vs. Global temporary table

In this article today I am going to explain the difference between Local and Global Temporary table in sql server

Description:
Temporary tables are created at runtime and we can do all operation which we can do on a normal table. Temporary tables are stored in System Databases >> tempdb database.
Temporary tables are of two types:
1. Local Temporary tables
2. Global Temporary tables

Sunday, September 6, 2015

Asp.net Select, Edit, Update and Delete record in Gridview using Entity Framework

In this article I am going to explain how to Edit, update and delete the record in Gridview data control using Entity Framework and Asp.net

Description:

I have created a table Movie in database and inserted the records into it. Now I will fetch the records from this table and display them in Gridview data control and edit, update and delete the record.

Implementation:
To set up the ADO.net entity framework project read the article How to setupADO.net Entity Framework project or website in asp.net.

Add a webform to project/website.

Saturday, September 5, 2015

Asp.net Entity Framework Fetch records and display in Gridview

In this article I am going to explain how to fetch the records from Sql server database and display in Gridview using Entity Framework in Asp.net

Description:

In this tutorial select the records from Sql server database using database first approach. I have created a table Movie in database and having records in it. I am going to display the records in Gridview data control.

Implementation:
To set up the ADO.net entity framework project read the article How to set upADO.net Entity Framework project or website in asp.net.

Friday, September 4, 2015

Insert record into Sql server database using Store Procedure and Entity framework in asp.net

In this article I am going to explain how to insert record into Sql server database using Store Procedure and Entity framework in asp.net

Description:

Insert record into Sql server database using Store Procedure and Entity framework in asp.netIn this tutorial I will insert the record/data into sql server database using database first approach. I have created a table Movie in database.

How to insert record into Sql server database using Entity framework in asp.net

In this article I am going to explain how to insert record into Sql server database using Entity framework in asp.net

Description:

How to insert record into Sql server database using Entity framework in asp.netIn this tutorial I will insert the record/data into sql server database using database first approach. I have created a table Movie in database.




Tuesday, September 1, 2015

How to set up ADO.net Entity Framework project or website in asp.net

In this article I am going to explain how to set up a ADO.Net Entity Framework project or website in asp.net using Visual studio 2013

Description:

In this tutorial I am going to set up a project/website using database first approach. I already created a database.

Implementation:
To set up an ADO.net project/website follow the below given steps:

Step 1: Create a website/project
First of all create a website or project.

Step 2:
Now right click on website in solution explore. Go to Add >> Add new item.

How to set up ADO.net Entity Framework project or website in asp.net