SQL SERVER Hosting :: How to Create a WCF Service for Insertion and Retrieval of Data From SQL Server 2012 Express
|In this article will explains how to create a WCF service for Insertion and Retrieval of data.
Insertion and retrieval of data becomes easier with WCF services. Today we will discuss how to create a WCF service for this purpose.
Note: Before the Visual Studio application, first of all Install and create Database and Table in SQL Server Express 2012.
The following is the procedure to use.
1. Open Visual Studio 2013 and select WCF Service application project and name it.
2. Now right-click on the project’s name and “Add” -> “New item”.
3. Create a LINQ to SQL classes project and add it.
4. Now open the Server Explorer in Visual Studio and right-click on “Data Connections” and “Add New Connection”.
5. Now enter your Server Name (Instance Name) and select your database that is to be used.
6. You can “Test your Connection” and then click OK.
7. Now your SQL DB is connected to Visual Studio and it is added to the project, visible in the Server Explorer. Expand DB, then tables and drag your table to the middle screen and drop it there.
8. Now open IService.cs from the Solution Explorer and add this code.
9. Then open Service1.svc.cs and add this code.
10. Now you have created a WCF service. Now test whether or not the service works. Right-click on Service1.svc from the Solution Explorer and select “View In Browser”. Your expected result will look like this.
11. Now copy the link of service from the browser and save it in Notepad for further use.
Calling WCF Web Service from Windows Phone 8 Application
12. Open Visual Studio 2013 and create a Windows Phone Blank app.
13. In Solution Explorer, right-click on references and “Add New Service Reference”.
14. Then enter that copied URL and click Go. Then enter your Service Name and click OK.
15. In MainPage.xaml add this code.
16. In MainPage.xaml.cs, add this namespace for service reference.
1 |
<span style="color: #000000"> using PhoneApp.ServiceReference2;</span> |
17. Now add a new service object like this.
18. Then add this code behind the Insert Button’s click event.
19. Add this code behind the Find Button’s click event.
20. Then add a new page to the project and add a listbox in Page1.xaml.
21. Now add this code to Page1.xaml.cs.
22. Don’t forget to add a namespace in Page1.xaml.cs as in the following:
1 |
<span style="color: #000000">using PhoneApp.ServiceReference2;</span> |
23. Now rebuild the project, and press F5 and you are good to go :).
Note: To run WCF services perfectly with Windows Phone Emulator
Best Recommended SQL SERVER Hosting
ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable SQL SERVER hosting plan. ASPHostPortal the leading provider of Windows hosting and affordable SQL SERVER Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability.
HostForLIFE.eu
HostForLIFE.eu guarantees 99.9% uptime for their professional SQL SERVER 2014 hosting and actually implements the guarantee in practice. HostForLIFE.eu is the service are excellent and the features of the web hosting plan are even greater than many hosting. HostForLIFE.eu offer IT professionals more advanced features and the latest technology. HostForLIFe Best , Cheap SQL SERVER 2014 Hosting, Relibility, Stability and Performance of servers remain and TOP priority. Even basic service plans are equipped with standard service level agreements for 99.99% uptime. Advanced options raise the bar to 99.99%. HostForLIFE.eu revolutionized hosting with Plesk Control Panel, a Web-based interface that provides customers with 24×7 access to their server and site configuration tools.
DiscountService.com.au
DiscountService.com.au is The Best and Cheap SQL SERVER Hosting. DiscountService.com.au was established to cater to an under served market in the hosting industry web hosting for customers who want excellent service. DiscountService.com.au guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability. DiscountService.com.au has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch. DiscountService.com.au is devoted to offering the best Windows hosting solution for you