从数据库中填充Silverlight中的数据 [英] Populate data in silverlight from database

查看:65
本文介绍了从数据库中填充Silverlight中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Silverlight应用程序,在Visual Studio 2010中使用C#中的代码.我的要求是我要有一个带有许多不同控件的表单(示例文本框,组合框).我想从数据库中的所有这些控件中填充数据,这些值来自数据库的不同表(例如CountryMaster中的Combo中的CountryName,CityMaster中的Combo中的CityName)等.现在如何在Service.svc文件中构造方法并在我的XAML文件中访问它们,以填充控件中的数据.组合应该具有表中特定列的所有值(就像所有国家名称都应添加到组合控件一样)此外,当用户单击选择"按钮时选择所有组合后,选定记录"应在DataGrid中显示.

在Advance中致谢

I have a Silverlight Application,with Code in C# in Visual Studio 2010. My requirement is i have a form with many different controls(Example textboxes,combo boxes). I want to fill data in all these controls from Database,the values are comiing from different tables of the database(like CountryName in Combo from CountryMaster,CityName in Combo from CityMaster) etc.Now how can i construct methods in Service.svc file and access them in my XAML file to populate data in my controls. Combo''s should have all the values in particular column of the Table(like All the Country Names should be Added to Combo Control) Also that after selecting All the combo''s when a user clicks on a Select button the Selected Record should be displayed in DataGrid.

Thanks in Advance

推荐答案

您需要使用Web服务(或RIA服务)来访问数据库,因为Silverlight应用程序无法使用各种.Net SqlConnection和SqlCommand对象.我认为使用RIA服务更简单.

MSDN创建RIA服务解决方案 [
You need to use a web service (or RIA Services) to access your database because Silverlight apps cannot use the various .Net SqlConnection and SqlCommand objects. I think it''s simpler to use RIA Services.

MSDN Creating a RIA Services Solution[^]


这篇关于从数据库中填充Silverlight中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆