Find Current User Information

SELECT spid, uid=rtrim(loginame), Program_name=rtrim(Program_name),
dbname=db_name(dbid), status=rtrim(status) FROM master.dbo.sysprocesses
WHERE loginame = 'UserName';


You can also use sp_who command to see all users associated with current database.

Retrieve and Upload data From ExcelWorkbook

I got this link is very helpful when you want to upload data in bulk from the excel workbook

or you have to retrieve the data from the excel workbook.

http://support.microsoft.com/default.aspx?scid=kb;en-us;316934#12

Difference between Web Services and Remoting?

Both Remoting and Web Services are ways of communication between applications.

Remoting - In remoting, the applications involved in the communication process may be located on the same computer, different computers in a same or different network. In remoting, both applications know about each other. A proxy of an application object is created on the other application.

Web Services - Communication between applications using web services is platform independent and programming independent. The application that consumes the web service, simply accesses it, without needing to know how this web service has actually been implemented & created.

Here are some of the major differences:
* ASP.NET Web Services may be accessed using HTTP only. Remoting objects may be accessed over any protocol like TCP, SMTP, HTTP
* Web Service are Stateless, whereas Remoting has support for both stateless and with-state environment, which is achieved using Singleton and Singlecall activation
* ASP.NET provides good support to create Web Services. They are easy to deploy. In comparison, Remoting is little complex.
* Web services may be considered very reliable, due to the fact that they are hosted on IIS. In remoting, if IIS is'nt used, then methods like plumbing have to be used to ensure the application reliability.
* In .NET, when we create an application that consumes a web service, the web service may or may not be built using .NET. But while implementing Remoting in .NET, both the applications must be built in .NET.
* Using web services, only a limited number of types may be serialized (XML). Using Remoting, objects like SOAP objects, Binary objects & XML Objects may be serialized.

Different Language class file in app_code

Question : Can we keep different language class file in app_code directory at the same time?Answer : Yes we can keep the different language class file in the App_Code directory but when we try to keep the different language file in the directory it raise an error like :
Error :
'App_Code/Class2.vb' and 'App_Code/Class1.cs' use a different language, which is not allowed since they need to be compiled together.
To resolve this problem, we keep the different language class file in the different folder and we have to set the codeSubDirectories in the web.config file under the compilation tag like this

<compilation debug="true">
<codesubdirectories>
<add directoryname="CsCode">
<add directoryname="VbCode">
</codesubdirectories>
</compilation>

Convert the Rows value into CSV format

From this query you can convert row value into comma separated valuse

CREATE TABLE #tblTblValues (id int)
insert into #tblTblValues values (10)
insert into #tblTblValues values (20)
insert into #tblTblValues values (30)
insert into #tblTblValues values (40)
insert into #tblTblValues values (50)
insert into #tblTblValues values (60)
insert into #tblTblValues values (70)


DECLARE @Value varchar(2000)
SELECT @Value = COALESCE(@Value + ', ', '') + CAST(id AS varchar) FROM #tblTblValues
SELECT @Value
OutPut


10, 20, 30, 40, 50, 60, 70

Debug the Stored Procedure OR Functions in SQL?

Do you know how to debug the stored procedure OR functions in SQL?

Here the way you can debug you stored procedure and function.

Steps to debug the stored procedure/ function :

Step 1 : Create a web project/windows project according to your preference
Step 2 : Connect to your database server through server Explores (See below screenshot)
Step 3 : Expand your stored procedure/Function
Step 4 : open the procedure/ function and set breakpoint
Step 5 : Now Right click on the stored procedure / function you want to debug
Step 6 : Click on Step into stored procedure/ function
Step 7 : Set default parameter values

Now it will take to you break point.
See the screen shot below

Access Different interface method with same Name implemented in a class

We use interface and multiple interface inherit it into class, then we implement the methods of interface as it is necessary
but what will happen if two interface have the same mentods with same signature and inherited in the same class?
Now questions arises from here are :
Q1) Both the methods will be implementable which is with the same name and signature?
Q2) If methods are implementable then how it is possible?
Q3) If it is possible then can we access both the methods?
Q3) If it is possible then what is the way to access these methods publically?

The answer of all the above question is below:
1) Yes both the methods with same name and signature is implementable.
2) we have to implement interface explicitely preceding with iterface name.
3) Yes it is possible to access the methods.
4) Yes we can