开发者

How to query SQL Server through Silverlight web project?

开发者 https://www.devze.com 2023-01-31 18:08 出处:网络
I passed the hello world phase in the Silverlight world but I found out that ADO.NET is not pa开发者_StackOverflowrt of the party. :_(

I passed the hello world phase in the Silverlight world but I found out that ADO.NET is not pa开发者_StackOverflowrt of the party. :_(

I'd like to know what is the easiest method to retrieve tables\rows\single value from SQL Server. (At the moment I have a very small DB, so simplicity is more important than complicated smart solutions that can handle large amount of data.)

I what to be able to send a query like:

SELECT * FROM a JOIN b....

I found this article which I'm learning at the moment, yet I'd like to know if there are other ways to access the DB.

Thanks Asaf


Other way is to use WCF RIA service.
You can't access a database directly from a Silverlight application.
The only way is to use some service.

Here you can learn how to do that with RIA service.


As suggested above, use WCF. This means setting up a WCF service on the webserve which does all the SQL magic. You may want to look at LINQ2SQL (obsolete) or Enterprise Framework for accessing database in this service. In Silverlight you just connect to the WCF service and it will be like magic, especially if you use LINQ.

Remember that you must access the same server your Silverlight app was downloaded from. If not there are special rules that apply.

For binding the data and interface Silverlight (and WPF) supports the MVVM model. This model really simplifies GUI implementation and makes it very easy to maintain the code.

0

精彩评论

暂无评论...
验证码 换一张
取 消