.NET Framework Interview Questions and Answers (547) - Page 23

What is the main difference between the Button server control and the Button Html control?

when clicked the Button server control triggers are asp.net click event procedure on the server.The Button HTML control triggers the event procedure indicated in the buttons onclick attribute,which runs on the client.
Why can't you open a new browser window from within server code?

Server code executes on the server, where as the new window is created on the client.You need to use the client-side code to do things that affect the client,such as upload files,display new windows or navigate back in history.
How to Delete the Duplicate values in sql table?

create table:

Create table emp (Eno int ,EmpName varchar(10),Dept varchar(10))


Insert Values:


insert into emp values(1,'John','IT')
insert into emp values(1,'John','IT')
insert into emp values(2,'Maxx','CSE')
insert into emp values(3,'Cany','AUTO')
insert into emp values(2,'MAXX','CSE')
insert into emp values(1,'SONY','IT')


Select * from emp

Eno EmpName Dept
1 John IT
2 Maxx CSE
3 Cany AUTO
2 MAXX CSE
1 SONY IT
1 John IT


Find the duplicate values from the table:



WITH tempTable as(
SELECT ROW_NUMBER() Over(PARTITION BY eno,empname ORDER BY eno) As RowNumber,* FROM emp
)
select * from tempTable where RowNumber >1


Delete duplicate Rows with CTE


WITH tempTable as(

SELECT ROW_NUMBER() Over(PARTITION BY eno,empname ORDER BY eno) As RowNumber,* FROM emp
)
DELETE FROM tempTable where RowNumber >1


---After Deleting the duplicate values
select * from emp

Eno EmpName Dept
1 John IT
3 Cany AUTO
2 MAXX CSE
1 SONY IT

How to import Excel into Sql table by using Store Procedure?

Exec SP_Excel 'Report.XLSb'

Create PROC SP_Excel 

(
@ExcelName VARCHAR(100)
)
As
Begin
Declare @SQL VARCHAR(1000)
if OBJECT_ID('Table1') is not null
drop table Table1

SET @SQL= 'select * INTO Table1 from openrowset (''Microsoft.ACE.OLEDB.12.0'',''Excel 12.0;Database=d:\Sharedd\'+@ExcelName+''',[Sheet1$])'
EXEC(@SQL)

End

You are creating a generic class that should work only with value types. Which type constraint should you add?

NOTE: This is objective type question, Please click question title for correct answer.
You are developing web application in which you need to encrypt a large amount of data. Which algorithm do you use ?

NOTE: This is objective type question, Please click question title for correct answer.
Found this useful, bookmark this page to the blog or social networking websites. Page copy protected against web site content infringement by Copyscape

 Interview Questions and Answers Categories