programming4us
programming4us
DATABASE

SQL Azure : Building Two OData Consumer Applications (part 1) - Simple Demo App

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
The rest of this article focuses on building two applications that consume the OData service that you just enabled on your SQL Azure database. The first one is very simple, to whet your appetite and show you the basics. The second is the cool one. (But don't skip the first one!)

7.5.1. Simple Demo App

For this first example, create a Windows Forms Application project. The name of the project and language don't matter. When your project is created, follow these steps:

  1. Drop a list box and a button on the form.

  2. In Solution Explorer, right-click the References node, and select Add Service Reference from the context menu.

  3. When the Add Service Reference dialog appears, you need the URI you copied from this article. Paste it into the Address field, and click the Go button. After several seconds the available services and associated endpoints appear in the Services section of the form, as shown in Figure 1.

    Figure 1. Adding the OData service reference
  4. Leave the Namespace name as is, and click OK. A new Service Reference node appears in Solution Explorer, which lists the service you just added.

  5. In the code behind the form, add the following using statements:

    using System.Data.Services;
    using System.Data.Services.Client;

  6. In the declaration section, add the following two lines of code. The first line declares your context variable, which references the newly added service; the second line defines the URI that accesses the OData service:

    private ServiceReference1.TechBio context;
    private const string svcUri = "https://OData.sqlazurelabs.com/OData.svc/v0.1/servername/TechBio";

  7. In the button's click event, add the following code:

    context = new ServiceReference1.TechBio(new Uri(svcUri));

    var userQuery = from u in context.Users
    select u;

    foreach (var u in userQuery)
    {
    listBox1.Items.Add(u.Name);
    }

  8. Run the application. When the form displays, click the button. After a few seconds, the list box populates with usernames, as shown in Figure 2.

    Figure 2. Form displaying data via the OData service

Very simple, but a good foundation to build on. This example gives you an idea of how you can consume on OData service via a .NET application. But you're probably tired of waiting, so let's move on to the really cool example: the Windows Phone application.

Other  
 
Top 10
Free Mobile And Desktop Apps For Accessing Restricted Websites
MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
TOYOTA CAMRY 2; 2.5 : Camry now more comely
KIA SORENTO 2.2CRDi : Fuel-sipping slugger
How To Setup, Password Protect & Encrypt Wireless Internet Connection
Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
Backup & Restore Game Progress From Any Game With SaveGameProgress
Generate A Facebook Timeline Cover Using A Free App
New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
- Messages forwarded by Outlook rule go nowhere
- Create and Deploy Windows 7 Image
- How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
- Creating and using an unencrypted cookie in ASP.NET
- Directories
- Poor Performance on Sharepoint 2010 Server
- SBS 2008 ~ The e-mail alias already exists...
- Public to Private IP - DNS Changes
- Send Email from Winform application
- How to create a .mdb file from ms sql server database.......
programming4us programming4us
programming4us
 
 
programming4us