المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Same entries in Listbox from WCF



C# Programming
08-21-2012, 12:31 PM
Ive followed this guide: http://studentguru.gr/b/dt008/archive/2010/12/02/querying-a-database-on-windows-phone-7-using-wcf.aspx[^ (http://studentguru.gr/b/dt008/archive/2010/12/02/querying-a-database-on-windows-phone-7-using-wcf.aspx)]

I have tree different entries in my SQL and then i launch my application I get tree entries but they are all a copy of the first one.

CODE:

NSSService which is on my ISS.
using System;using System.Linq;using System.Runtime.Serialization;using System.ServiceModel;using System.ServiceModel.Activation;using System.Collections.Generic; namespace NSSWebServiceApplication{ [ServiceContract(Namespace = "")] [SilverlightFaultBehavior] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class NSSService { [OperationContract] public List GetAllServer_Logs() { // Add your operation implementation here using (NSSEntities entities = new NSSEntities()) { var allServer_Logs = from x in entities.Server_Log select x; return allServer_Logs.ToList(); } } // Add more operations here and mark them with [OperationContract] }}
MainPage on the app
using System;using System.Collections.Generic;using System.Linq;using System.Net;using System.Windows;using System.Windows.Controls;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Animation;using System.Windows.Shapes;using Microsoft.Phone.Controls;using NSSPhoneApp.NSSServiceReference;using System.ServiceModel; namespace NSSPhoneApp{ public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); this.Loaded += new RoutedEventHandler(MainPage_Loaded); } void MainPage_Loaded(object sender, RoutedEventArgs e) { NSSServiceClient client = new NSSServiceClient(); client.GetAllServer_LogsCompleted += new EventHandler(client_GetAllServer_LogsCompleted); client.GetAllServer_LogsAsync(); } void client_GetAllServer_LogsCompleted(object sender, GetAllServer_LogsCompletedEventArgs e) { if (e.Error == null) { lst.ItemsSource = e.Result; } } }}
Thanks.