13 April, 2014

Run DLL error message/background container.dll

 

1. Go to Start > Control Panel > Administrative Tools.
2. Open Task Scheduler and click on Task Scheduler Library.
3. Look through the list for an entry related to BackgroundContainer.
4. If found, right-click on it and select Delete.
5. Exit all programs and reboot the computer when done.

10 April, 2014

Adding Comments in C# Code

To add comments in C# code
  1. Open a .cs file in an editor.
  2. Switch to Code view.
  3. Enter /// followed by any XML tags or text strings. If you enter /// on the line before the definition, the editor creates a template of a documentation comment and fills in the parameters and other information. For example, in the file class1.cs before public Class1() you could enter the following:
    ///<summary>
    ///summary description
    ///</summary>
    ///<remarks>
    ///This is a test.
    ///</remarks> 
    In the code structure for the Class1, the information listed within the <summary></summary> tags appears in the Description column. The information listed within <remarks></remarks> tags appears on the detailed page for class1 in the Remarks section

26 June, 2013

Export data from Microsoft SQL server to CSV file using stored procedure

Write following procedure and execute:-

But before that you need to enable xp_cmdshell
So you need to execute these for enable xp_cmdshell
/****************************/


EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE
GO


/****************************/
 Then write procedure



Create PROC spExportToCSV
@FilePath varchar(100)
AS
BEGIN

DECLARE @SQL VARCHAR(500)
SET @SQL='SELECT * FROM [DB name].dbo.[Table Name]'

SET @SQL='SQLCMD -E -Q "SET NOCOUNT ON; '+@SQL+'" -o "'+@FilePath+'" -h-1 -s "," -W'
-- -h-1 for no header
-- if remove -h-1 then 1 header
--  -h1 then after every row there is header and so on
EXEC master..xp_cmdshell @SQL
END