Posts

Showing posts from September, 2012

Test & Debug WCF service using WCFTestClient.exe

Image
VS.NET 2010 provides WCFTestClient.exe for us to test and debug the WCF service.  Please follow me to test and debug the service. Generally, first debug and then test the service, but here first I will tell you how to test it and then how to debug it J Test the WCF service using WCFTestClient. 1.        Open “Visual Studio Command Prompt (2010)” 2.        Go to “c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\” 3.        Run WcfTestClient.exe 4.        It will open WCF Test Client, now add WCF Service (URL) 5.        Select the service method, from left panel 6.        Provide request data (i.e. values to parameters) on right panel and click on Invoke button. It gives you the response. Debug the WCF service, follow the commands. 1.        Go to WCF service project properties 2.        Go to Web menu on left menu 3.        Select WcfTestClient.exe from “c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\” for “Start external progr

Alternate to Dynamic SQL for Search SPs

Today had a chance to work on ‘Search’ functionality using SQL Server stored procedure. Usually we write dynamic SQL in stored procedure for ‘Search’ing purpose. End user might consider few or all attributes as search criteria. To execute the SQL statement, we use sp_executesql We have an alternate to dynamic SQL, using simple select query. Below is the sample. Dynamic SQL Sample: CREATE PROCEDURE [SearchOffcie]      (   @OfficeName VARCHAR ( 100 )         , @OfficeType VARCHAR ( 50 )         , @Address1 VARCHAR ( 100 )         , @Address2 VARCHAR ( 100 )         , @City VARCHAR ( 50 )         , @State CHAR ( 2 )         , @OfficeTypeID INT         ) AS            BEGIN       SET NOCOUNT ON       DECLARE @SqlQry NVARCHAR ( 4000 ) = ''           DECLARE @WhereCondition VARCHAR ( 200 ) = ''           DECLARE @SearchCriteria VARCHAR ( 200 ) = ''           -- Criteria        BEGIN