0

I'm completely new to Silverlight and I want to connect to a Netezza database with an ODBC connection and pull records to display nicely in Silverlight. What's the easiest way to do this?

From some research, it seems creating a WCF RIA service is what most people do ( http://www.codeproject.com/Articles/354715/Creating-a-WCF-RIA-Services-Class-Library-for-a-Si ) but the process seems a bit convoluted. Coming from an ASP.net background, could I do something simpler like creating an ODBC connection in the code-behind (using System.Data.ODBC functionality), executing a query, storing the returned records in a Datatable and then binding that to some Silverlight control?

user1384831
  • 219
  • 1
  • 5
  • 14

2 Answers2

2

In general, direct access to data sources via ODBC, ADO.NET, etc., isn't part of the Silverlight DNA. Silverlight is a browser/client technology and exposing databases on the internet really isn't a good idea. That's why the primary approaches are services, such as WCF RIA Servers, WCF Data Services, etc.

You'll also note that all remote calls are asynchronous, again emphasizing the client to server flow over the internet and 'encouraging' developers to provide a fast and responsive user experience.

With Silverlight Out-of-Browser (e.g., running Silverlight on the desktop) you can use the COM+ capabilities to do just about anything, but that's not the common approach to forms-over-data type applications.

Jim O'Neil
  • 23,344
  • 7
  • 42
  • 67
0

Technically you can do what you describe, but you really shouldn't (in ASP.net or Silverlight).

By going directly against the db you lose opportunities for security, code re-use, caching, testability and a host of other good things that come from separating your "view" from your dataprovider.

There are a lot of good reasons that people with years of experience and more brain power than I could dream of have developed patterns like MVC and MVVM (the defacto Silverlight standard). I highly recommend that you read up more on these patterns and the principles of "SOLID" design.

It will take your development into whole new worlds and you will end up a far better developer.

Mike Parkhill
  • 5,511
  • 1
  • 28
  • 38