vitall
vitall

Reputation: 161

Make connection and retrieve data from SQL Server 2008 Using SilverLight

I'm newbie in Silverlight world. I read number of articles to establish connection with SQL Server using Silverlight but sorry to say no one give me concrete results. I want to first make a connection with SQL Server database and then simply load data in combo box. Can anyone give any sound step wise example to make connection with Silverlight project. I found WCF service which is quite helpful to establish connection but feel difficulty to map this service. Please also suggest any other web service with WCF, thanks.

Upvotes: 1

Views: 2358

Answers (1)

marc_s
marc_s

Reputation: 754528

When you look at the Silverlight architecture, you'll see that the ".NET for Silverlight" runtime doesn't include any classes to directly access databases:

http://msdn.microsoft.com/en-us/library/bb404713%28v=vs.95%29.aspx

enter image description here

It contains service client classes, however - so you can use WCF (and WCF RIA Services) to fetch data from a remote server.

That approach makes a lot of sense, too - your Silverlight app will after all run on the client PC, typically in a browser - and you don't really want hundreds or thousands of client PC's anywhere over the planet to have direct access to your SQL Server database. Channelling these data requests through services makes a lot of sense in that way.

This is in contrast to ASP.NET where your code typically runs on the backend server infrastructure, so it's a lot "closer" to your database servers and can make direct calls to SQL Server - it then just returns HTML to the caller (the client's PC and browser).

I found this article here very informative and enlightening:

Upvotes: 3

Related Questions