Friday, November 16, 2012

How to permanently delete a file from Team Foundation server

tf destroy $/proj/proj/proj/projEntities.Designer.cs /login:admin,abc@123 /collection:http://server:8080/tfs/proj

Friday, February 3, 2012

Deploying a .Net crystal report website on a shared server

Hi Guys,

Deploying a crystal report website on a shared server has really been a very difficult task. I have been using rdlc reports upto now for my web applications, but due to the limitations they have I had to use crystal report to one of my web applications, that's when I had to learn this thing, and also realised that many of the guys are struggling with this issue and some of them are not able to sort this thing out for months/years. Though there so many deployment issues which is not possible for me to list out, but here I am writting steps to deploy a crystal report site, which you can use as a primary guideline for deploying a crystal report website.

1. Put the following DLLs to your BIN directory at your shared server.


2. Install the appropriate crystal report redistributable(the redistributable applicable for the version you are using) at server.

3. Give the IIS user account and worker process account full control for the reports folder.

4. Make sure to give 'everyone' full control to the temp directory of windows.

5. for more information and support log on to

wish you all the best for your deployment.

Monday, January 30, 2012

tsql function to convert a column value to csv

Option 1:

alter function udf_get_csv_faults (@unit varchar(4),@jobno int)
returns varchar(500)
declare @csv varchar(2048)
(SELECT ',' + s.detail
FROM vw_job_sheet_fault s
where s.js_unitcode=@unit and s.js_jobno=@jobno
FOR XML PATH('')),2,500)
return @csv

Option 2:

create FUNCTION udf_get_csv(@unit varchar(4),@jobno int)
RETURNS varchar(500)
declare @csv varchar(500)
Select @csv = null
SELECT @csv = Coalesce(@csv + ', ', '') +
FROM vw_job_sheet_fault s
where s.js_unitcode=@unit and s.js_jobno=@jobno


Friday, January 20, 2012

code for crystal report

Visual Studio 2005 and Crystal Report XI.

1. Create a Crystal Report as usual in Visual studio 2005 .net
using ODBC connection. In this example "CrystalReport.rpt"

2. Create a aspx web form to display the report. This form will
be a place holder for crystal report.

3. In design mode, drag and drop Crystal Report viewer control and
don't configure anything.

4. Open code behind .aspx.vb

'Declare public variable

Private myReportDocument As ReportDocument

'Note: This is Page Init event not Page Load event

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()

' Note: This is your local ODBC Name NOT SQL SERVER NAME

myConnectionInfo.ServerName = "PUBSODBCNAME"

' If your ODBC connection defaulted to your application database,
' you can remove the following line.

myConnectionInfo.DatabaseName = "Pubs"
myConnectionInfo.UserID = "userid"
myConnectionInfo.Password = "password"

myReportDocument = New ReportDocument()
'If your crystal report is in some other folder, give proper path
' In this example, .rpt file in the same folder as .aspx file
Dim reportPath As String = Server.MapPath("CrystalReport.rpt")
SetDBLogonForReport(myConnectionInfo, myReportDocument)
CrystalReportViewer1.ReportSource = myReportDocument
' You can customize the Crystal Reports toolbar.
' like the following. I have disabled the business object logo
' in the tool bar.

CrystalReportViewer1.HasCrystalLogo = False

End Sub

'This Sub is necessary for Crystal report database connection

Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
Dim myTables As Tables = myReportDocument.Database.Tables
For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
5. Now run the .aspx page. You will see the report or the crystal report parameter
form. It will not ask you DB login information.

6. dont forget to Imports dll

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource