Calling ASP.NET Web Service Using Jquery - Part III - Fetch Data From SQL Server

by Prashant 11. March 2010 10:29

My previous two posts on using Jquery for calling ASP.NET web service takes you to the basics of calling a web service using Jquery AJAX. In this last post of the series I will show hot to fetch data from the SQL Server through a web service.

In this example I am going to show on how we can fetch data from SQL Server. I am using pretty well known Adventure Works database for this example. I am using Person.Contact table for this example. I will show on how to fetch data i.e. first name, last name and e-mail address on the basis of the ContactID.
So first, as usual create a normal ASP.NET project and add the required files. Create a new web service, I have named my web service “AdvService.asmx”. You can name your web service as you like. This time we are fetching data from the SQL Server by passing a parameter to the web service method. I am using the very same, basic way of fetching record from the SQL Server. You can also use LINQ here to fetch data.

I have used a delay of few seconds to how the animation, rest in the code is self explanatory. Just passing a parameter and fetching the details of the person from the Adventure Works database.Below are the screenshots for the sample application.

Download: JqueryAjaxSQLDemo.zip (97.86 kb)

If you enjoyed this post, make sure you subscribe to my RSS feed!

Tags: , , ,

ASP.NET | Jquery


Comments (2) -

Gobinath
Gobinath India
1/25/2012 7:37:57 PM #

hai prashant u sample is nice.i followed ur steps but iam getting an internal server error..how to correct it wat wil the problem

Reply

Prashant
Prashant India
1/26/2012 6:13:13 AM #

Are you using the same code sample as provided above? I suggest you to re-check the parameters you are passing in the data tag and also make sure that the connection string is correct.

Reply

Pingbacks and trackbacks (3)+

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


Visit blogadda.com to discover Indian blogs Computers Blogs

About Me

Name of authorPrashant Khandelwal.
Programmer and tech enthusiast. More...

Feeds Subscribe Twitter Facebook Google Plus Linked In Delicious

Badges

MVB

MVP Blog Badge.

HTML5 Powered with CSS3 / Styling, Graphics, 3D & Effects, Multimedia, Performance & Integration, Semantics, and Offline & Storage

Month List

Blog Stats

414,239 Hits

Adverts

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012

Creative Commons License