Thursday, March 18, 2010

C# equivalent of sql server’s IsNull() function

For converting a null value to some other values, you can use the the null coalescing (??) operator: as shown below.

string Message = null;
string result = Message ?? "No data";
Response.Write(result);
 
The above code will print "No data" if executed.
 
You can find more information in the below link.
http://weblogs.asp.net/scottgu/archive/2007/09/20/the-new-c-null-coalescing-operator-and-using-it-with-linq.aspx

Wednesday, March 10, 2010

How to port a select result from one table to a new table?

select * into xxxx from dbo.Crm_Company_Calender

Relace XXXX with your new table name.All the resilt from the select querry will be ported to the new table xxxx

How to Install Advetureworks DB from SQL Setup?

1.From Add or Remove Programs, select Microsoft SQL Server 2005 and click Change. Follow the steps in the Microsoft SQL Server 2005 Maintenance wizard.

2.From Component Selection, select Workstation Components and then click Next.

3.From Welcome to the SQL Server Installation Wizard, click Next.

4.From System Configuration Check, click Next.

5.From Change or Remove Instance, click Change Installed Components.

6.From Feature Selection, expand the Documentation, Samples, and Sample Databases node.

7.Select Sample Code and Applications.

8.Expand Sample Databases and then select the sample databases to be installed. Click Next.

9.To install and attach the sample databases, from Sample Databases Setup, select Install and attach sample databases, and then click Next.
The database files are created and stored in the folder :\Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\Data. The database is attached and ready for use.

Tuesday, March 9, 2010

How to Show a SSRS Report in a Windows Application?

Requesting a Server Report
reportViewer.ProcessingMode =
Microsoft.Reporting.WinForms.ProcessingMode.Remote;
// Get the Report Server endpoint from the application
// config file
reportViewer.ServerReport.ReportServerUrl = new
Uri(Settings.Default.ReportServerEndPoint);
reportViewer.ServerReport.ReportPath ="/Prologika/Customer Orders";
reportViewer.RefreshReport();
Handling Report Parameters
ReportParameter[] parameters = new ReportParameter[2];
parameters[0] = new ReportParameter("Date", "1/1/2003");
parameters[1] = new ReportParameter("CustomerID",
new string[] { "14335", "15094" });
reportViewer.ServerReport.SetParameters(parameters);

Monday, March 8, 2010

How to generate self-signed Secure Sockets Layer (SSL) certificate for Internet Information Services (IIS) 6.0?

SelfSSL version 1.0 is a command-line executable tool that you can use to generate and install a self-signed Secure Sockets Layer (SSL) certificate for Internet Information Services (IIS) 6.0. Because SelfSSL generates a self-signed certificate that does not originate from a commonly trusted source, the tool's usefulness is limited to two specific scenarios:

Download IIS 6.0 Resource Kit Tools from link

http://www.microsoft.com/downloads/details.aspx?FamilyID=56FC92EE-A71A-4C73-B628-ADE629C89499&displaylang=en

And use

SelfSSL version 1.0

SelfSSL (SelfSSL.exe) can help you generate and install a self-signed SSL certificate. Because the SelfSSL tool generates a self-signed certificate that does not originate from a trusted source, use the SelfSSL tool only in the following scenarios:
• When you have to create a security-enhanced private channel between your server and a limited, known group of users
• When you have to troubleshoot third-party certificate problem

You can find this exe in start->All Programs -> IIS Resources-> SelfSSL-> SelfSSL.exe

More information regarding "IIS 6.0 Resource Kit Tools " can be found at the below link
http://support.microsoft.com/kb/840671