Skip to main content


Showing posts from July, 2013

SQL Server: How to find a value in all Columns of all Tables in a Database

Sometime while working with SQL Server we have a value which is in database but we are not aware which table or which column is containing that value. Try finding some specific strings in a database with a number of tables, each with many columns and tens of thousands of records is a difficult thing to do if one tries to look out manually.
In this case we can obtain required information from the database by writing SQL query. Let’s write one stored procedure and then we can execute this stored procedure by providing search string.
CREATEPROCEDURESearch_From_AllTables @SearchValueNVARCHAR(500)-- Search string
AS BEGIN /**** Declare @searchQuery ****/ DECLARE@searchQueryNVARCHAR(MAX)=N''
/**** DROP [#TempResults] table if existing ****/ IFOBJECT_ID('tempdb.dbo.#TempResults')ISNOTNULL BEGIN DROPTABLEdbo.#TempResults END
/**** Create [#TempResults] table ****/ CREATETABLEdbo.#TempResults ([TableName]NVARCHAR(100), [ColumnName]NVARCHAR(100), [ColumnValue]NVARCHAR(MAX))
/**** Create @searchQu…

Error: Object doesn't support property or method 'removeExpression' with Simple Modal in IE

While working with Simple Modal jQuery plugin, you may get error ‘Object doesn't support property or method removeExpression' in IE9 browser, if you are using older version of Simple Modal plugin.  The error is due to the fact that support for dynamic properties has been removed in IE 9, so none of the getExpression, removeExpression, setExpression and recalc methods are supported. These methods exist in version 8, but using those raises exceptions.

Solution: Upgrade your Simple Modal plugin with latest plugin, latest release at the time of writing this post is SIMPLEMODAL1.4.4, and with that you’ll not get error anymore, or if you don’t want to upgrade the jQuery plugin then try to update your plugin code like this one.
Hope that helps!!!

Difference between Web API, WCF and Web Service

So now we have got the basic idea about Web API, now let’s do some comparison of Web API with WCF and web services.
Web Service WCF Web API Web services created as file with .asmx extension. WCF create with .svc extension Web API are simple class file with .cs(for C#) extension. Web API is inherited from “ApiController” and class name must end with “Controller”. It is SOAP based service and return data in XML form. It is also based on SOAP and return data in XML form. Web API is HTTP based service and by default it return data in JSON or XML form. It supports only HTTP protocol. It supports various protocols like TCP, HTTP, HTTPS, Named Pipes, and MSMQ. It supports HTTP protocol. It can be hosted only on IIS. It can be hosted with in the application or on IIS or using window service. It can be hosted with in the application or on IIS. It is not open source but can be consumed by any client that understands xml. It is not open source but can be consumed by any client t…

Introduction to ASP.NET Web API Features and why should we use Web API?

HTTP is not just for serving up web pages. It is also a powerful platform for building APIs that expose services and data. HTTP is simple, flexible, and ubiquitous. Almost any platform that you can think of has an HTTP library.
The ASP.Net Web API shipped with ASP.Net MVC 4 and is a framework for building HTTP services. ASP.NET Web API is a framework for building web APIs on top of the .NET Framework. With the help of Web API we can create RESTful services which can be consumed by a broad range of clients including browsers and mobile devices.
Web API Features:
·Web API is an HTTP Service. ·It uses HTTP as an Application protocol, not a transport protocol. ·Web API is an ideal platform for building pure HTTP based services where the request and response happens with HTTP protocol. ·Web API can be hosted with in the application or on IISand with Web API 2 you can host it on Cloud. ·It is designed for broad range of clients including browsers and mobile devices. ·Web API come with MVC4 and…

Failed to find or load the registered .net framework data provider for sqlite

While using “sqlite” one can encounter error “failed to find or load the registered .net framework data provider.”
We can solve the issue by taking care of following things:

Fix your DbProviderFactories entry in the config file (i.e. web.config or app.config) to reference the full (version and public key information) assembly name instead of the partial assembly name. A full reference allows .NET to search the GAC for SQLite. Here's a "full" reference example:
<DbProviderFactories>   <addname="SQLite Data Provider"invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=, Culture=neutral,PublicKeyToken=db937bc2d44ff139"/> </DbProviderFactories>
However, if you're deploying to a production machine without access to the machine's GAC or the ability to register a provider on the GAC on the destination machi…

SQL SERVER: Get count of duplicate records in SQL Server

There are requirements where we need to find out count of duplicate records in a table, we can do it by using GROUP BY, HAVING, ORDER BY and COUNT in one query.
This query will returns the results with duplicate column and its count in descending order.