Skip to main content

Posts

SQL Server: Check if string contains substring with CHARINDEX function

If you need to look for a specific word or substring within a string, you can achieve it with the help of SQL Server CHARINDEX function CHARINDEX function is used to search for specific word or substring in overall string and returns its starting position of match. If no matching word found then it will return 0. CHARINDEX syntax: CHARINDEX ( expressionToFind, expressionToSearch [, start_location ] ) Example to find specific word: DECLARE @testStr VARCHAR ( 250 ) SET @testStr = 'This is a test string' SELECT CHARINDEX ( 'test' , @testStr ) Output: ----------- 11 (1 row(s) affected) Example to find word with specific start location defined: DECLARE @testStr VARCHAR ( 250 ) SET @testStr = 'This is a test string' SELECT CHARINDEX ( 'test' , @testStr , 5 ) Output: ----------- 11 (1 row(s) affected)

Calling or consuming the ASP.Net Web API using jQuery and JavaScript

In our last post we have created our first Web API and invoked the web API directly from the browser; in this article we will use jQuery/JavaScript for calling the Web API methods. So our Web API is already in setup and we’ll use same Web API methods (note that fixed list of Customer is updated only). Replace the code of Index.cshtml view with the following: < header >     < div class ="content-wrapper">         < div class ="float-left">             < p class ="site-title">                 < a href ="~/"> ASP.NET Web API </ a >             </ p >         </ div >     </ div > </ header > < div id ="b...

Getting started with ASP.Net Web API Tutorials

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. 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. Your First ASP.NET Web API ASP.NET Web API is a framework for building web APIs on top of the .NET Framework. In this tutorial, we’ll create a web API in ASP.Net to become familiar with Web API. Calling or consuming the ASP.Net Web API using jQuery and JavaScript In our last post we have created our first Web API and invoked the web API directly from the browser; in this article we will use jQuery/JavaScript for calling the Web API methods. Hope you have enjoyed learning Web API, your comme...

Your First ASP.NET Web API in Action.

ASP.NET Web API is a framework for building Web APIs on top of the .NET Framework. In this tutorial, we’ll create a web API in ASP.NET to become familiar with Web API. So let’s start J Open Visual Studio IDE > Create New Project > Under Web Template > Select ASP.NET MVC 4 Web Application > and provide a name (in this case TestWebAPI) and select the location. On next screen select “Web API” under template and click OK. Your default WebAPI project is created and ready for use; let’s have a look at the file and directories of the default project. Folders Description App_Data This folder contains application data files. App_Start Contains different configuration files Content All the themes and styles files are added under this folder. Controllers Conations Web API controllers Images Contains Images of the project Models Models folder used to crea...