2015-02-07 10 views
0

아래 오류가 발생하며 응용 프로그램이 정상적으로 4 시간 이상 실행 되었기 때문에 그 이유를 알 수 없습니다. 하지만 지금은'System.Data.SqlServerCe.SqlCeException'형식의 처리되지 않은 예외가 System.Data.Linq.dll에서 발생했습니다.

유형 'System.Data.SqlServerCe.SqlCeException'의 처리되지 않은 예외가

System.Data.Linq.dll

에서 발생 .. 작동하지 않습니다와 나는 아무것도 변경되지 않았다

줄에 오류가 발생했습니다 db.SubmitChanges(); .. 아래에서 전체 코드를 남깁니다.

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 System.IO.IsolatedStorage; 
using System.IO; 
using Microsoft.Phone.Shell; 
using System.ComponentModel; 
using System.Data.Linq; 
using System.Collections.ObjectModel; 

namespace Aplicativo_Windows_Phone 
{ 
    public partial class AddColetor : PhoneApplicationPage 
    { 
     string email; 

     public AddColetor() 
     { 
      InitializeComponent(); 
     } 

     protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) 
     { 
      base.OnNavigatedTo(e); 
      NavigationContext.QueryString.TryGetValue("email", out email); 
     } 

     private void btnAdd_Click_1(object sender, RoutedEventArgs e) 
     { 
      AppDataContext db = new AppDataContext(); 
      Coletor coletor = new Coletor(); 
      if (rdNorte.IsChecked == true) 
      { 
       coletor.Latitude = Convert.ToInt32(txtLat.Text); 
      } 
      else 
      { 
       coletor.Latitude = Convert.ToInt32(txtLat.Text) - (2 * Convert.ToInt32(txtLat.Text)); 
      } 

      if (rdLeste.IsChecked == true) 
      { 
       coletor.Longitude = Convert.ToInt32(txtLong.Text); 
      } 
      else 
      { 
       coletor.Longitude = Convert.ToInt32(txtLong.Text) - (2 * Convert.ToInt32(txtLong.Text)); 
      } 

      if (txtLat.Text != "" && txtLong.Text != "" && rdNorte.IsChecked == true || rdSul.IsChecked == true && rdLeste.IsChecked == true || rdOeste.IsChecked == true) 
      { 
       foreach (var pessoa in db.Pessoas) 
       { 
        if (pessoa.Email == email) 
        { 
         pessoa.Coletores.Add(coletor); 
        } 
       } 

       db.Coletores.InsertOnSubmit(coletor); 
       db.SubmitChanges(); 

       NavigationService.Navigate(new Uri("/ColetoresPage.xaml", UriKind.RelativeOrAbsolute)); 
      } 
      else 
      { 
       MessageBox.Show("Preencha todos os campos e marque as opções para adicionar um coletor"); 
      } 
     } 

     private void btnCancel_Click_1(object sender, RoutedEventArgs e) 
     { 
      NavigationService.Navigate(new Uri("/ColetoresPage.xaml", UriKind.RelativeOrAbsolute)); 
     } 

    } 
} 

Coletor 클래스 :

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Data.Linq.Mapping; 
using System.Data.Linq; 
using Microsoft.Phone.Data.Linq; 
using Microsoft.Phone.Data.Linq.Mapping; 

namespace Aplicativo_Windows_Phone 
{ 
#pragma warning disable 0169, 0649 
    [Table(Name = "Coletores")] 
    public class Coletor 
    { 
     [Column(IsPrimaryKey = true, IsDbGenerated = true)] 
     public int Id { get; set; } 

     [Column] 
     public float Latitude { get; set; } 

     [Column] 
     public float Longitude { get; set; } 

     [Column(Name = "Pessoa")] 
     private int? pessoaId; 

     private EntityRef<Pessoa> _pessoa = new EntityRef<Pessoa>(); 

     [Association(Name = "FK_Coletores_ColetorPessoa", IsForeignKey = true, Storage = "_pessoa", ThisKey = "pessoaId")] 
     public Pessoa Pessoa 
     { 
      get { return _pessoa.Entity; } 
      set { _pessoa.Entity = value; } 
     } 

     private EntitySet<Ocorrencia> _ocorrencias = new EntitySet<Ocorrencia>(); 

     [Association(Name = "FK_Ocorrencias_ColetorOcorrencias", Storage = "_ocorrencias", ThisKey = "Id", OtherKey = "coletorId")] 
     public ICollection<Ocorrencia> Ocorrencias 
     { 
      get { return (from co in ColetorOcorrencias select co.Ocorrencia).ToList(); } 
      set { _ocorrencias.Assign(value); } 
     } 

     private EntitySet<PessoaColetor> _pessoaColetores = new EntitySet<PessoaColetor>(); 

     [Association(Name = "FK_PessoaColetores_Coletores", Storage = "_pessoaColetores", OtherKey = "coletorId", ThisKey = "Id")] 
     private ICollection<PessoaColetor> PessoaColetores 
     { 
      get { return _pessoaColetores; } 
      set { _pessoaColetores.Assign(value); } 
     } 

     private EntitySet<ColetorOcorrencia> _coletorOcorrencias = new EntitySet<ColetorOcorrencia>(); 

     [Association(Name = "FK_ColetorOcorrencias_Coletores", Storage = "_coletorOcorrencias", OtherKey = "coletorId", ThisKey = "Id")] 
     private ICollection<ColetorOcorrencia> ColetorOcorrencias 
     { 
      get { return _coletorOcorrencias; } 
      set { _coletorOcorrencias.Assign(value); } 
     } 

     public ICollection<Pessoa> Pessoas 
     { 
      get { return (from pc in PessoaColetores select pc.Pessoa).ToList(); } 
     } 
    } 
} 
+2

일반적으로 예외에는 메시지도 포함됩니다. 오류와 함께 제공되는 다른 정보가 있습니까? –

+1

메시지 및/또는 내부 예외가 없으면 누구에게도 도움이되지 않습니다. –

+0

실제로 다른 정보는 없습니다. 문제의 이미지를 보여줄 수는 있지만 여기에 이미지를 첨부하는 방법을 모르겠습니다. –

답변

0

좋아, 왜 그런지 모르겠지만 지금은 내 응용 프로그램이 작동 중입니다. 나는이 오류가 Visual Studio에서 일종의 버그라고 생각하여 내 문제를 해결하기 위해 방금 컴퓨터를 다시 시작했습니다.

+0

기술 지원에 문의하지 않으셨습니까? 컴퓨터를 다시 시작하려고 했습니까? – THBBFT

0

곧 사지에 나가서는 여기에 과거의 경험을 바탕으로. SqlServerCE 드라이버는 x86 및 x64의 두 가지 버전으로 제공됩니다. 일반적으로 컴퓨터에 하나만 설치할 수 있으며 두 번째 설치 프로그램은 실패합니다. 그러나 x64 드라이버를 먼저 설치 한 후 x64를 설치하면 명령 줄에서/force 스위치를 사용할 수 있습니다.

이렇게하면 제공된 세부 정보에서 귀하의 문제를 파악하는 데 도움이 될 수 있습니다.

+0

이것은 설치 가능한 드라이버가없는 ARM OS를 실행하는 Windows Phone입니다. –

+0

그래서 ... 코드를 읽지 않았습니다. – THBBFT

관련 문제