Autor |
Beitrag |
Nally
      
Beiträge: 46
|
Verfasst: Mi 10.12.08 12:08
Hallo,
dieser Fehler bringt mich noch in den Wahnsinn.
Lasse ich Zeile 29 weg, diese hier: this.view.DataToBindingSource(queryDepartment);
bekomme ich untere Meldung NICHT MEHR.
Error: bei Company.DepartmentPresenter.LoadDepartments() in C:\MVPSampleCompany\Company\Company\DepartmentPresenter.cs: Zeile 29.
A first chance exception of type 'System.NullReferenceException' occurred in Company.exe
ABER: was ich nicht verstehe und ich denke das liegt auch irgendwie an dem Error, dass die Departments am Anfang überhaupt nicht geladen werden... erst wenn ich ein
Department hinzufüge zur ListBox werden alle reingeladen/angezeigt in der ListBox. Irgendwas stimmt mit dem DataBinding in der LoadDepartments() methode nicht, denn das DataBinding in der ADD methode geht ja.
das ist der komplette Code dazu:
PRESENTER:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49:
| class DepartmentPresenter : IDepartmentPresenter { private CompanyEntities mycontext = new CompanyEntities(); private IDepartmentView view; private ObjectQuery<DEPARTMENT> queryDepartment;
public DepartmentPresenter(IDepartmentView view) { queryDepartment = new ObjectQuery<DEPARTMENT>("DEPARTMENT", mycontext); LoadDepartments();
this.view = view; view.PassViewDepartmentData += View_AddDepartment; }
private void LoadDepartments() { try { queryDepartment = mycontext.DEPARTMENT; this.view.DataToBindingSource(queryDepartment); } catch (Exception ex) { Console.WriteLine("Error: " + ex.StackTrace); } }
private void View_AddDepartment(String departmentName) { DEPARTMENT department = new DEPARTMENT();
try { department.department_name = departmentName; mycontext.AddToDEPARTMENT(department); mycontext.SaveChanges(); queryDepartment.Execute(MergeOption.AppendOnly); this.view.DataToBindingSource(queryDepartment); } catch (UpdateException ex) { Console.WriteLine("Error: " + ex.StackTrace); MessageBox.Show("Die Abteilung: " + departmentName + " existiert bereits", "Fehler!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } |
VIEW:
C#-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22:
| public partial class MainWindowView : Form , IDepartmentView { private IDepartmentPresenter departmentPresenter; public event PassViewDepartmentDataHandler PassViewDepartmentData;
public MainWindowView() { InitializeComponent(); departmentPresenter = new DepartmentPresenter(this); }
public void DataToBindingSource(ObjectQuery<DEPARTMENT> queryDepartment) { dEPARTMENTBindingSource.DataSource = queryDepartment; }
private void addDepartmentButton_Click_1(object sender, EventArgs e) { if (PassViewDepartmentData != null) PassViewDepartmentData(departmentTextBox.Text); } } |
EDIT:
SO:
nun habe ich die LoadDepartments() methode nicht im Konstruktor ausgeführt sondern führe diese Methode aus wie die Add Department Methode via Button_Click und sofort werden ALLE departments in der ListBox angezeigt. Demnach stimmt was mit dem Aufruf der LoadDepartments() methode im Konstruktor nicht... auch bekomme ich natürlich keine Error bzw. Exception mehr, kann jemand helfen bitte?
geänderter Code:
C#-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23:
| public DepartmentPresenter(IDepartmentView view) { queryDepartment = new ObjectQuery<DEPARTMENT>("DEPARTMENT", mycontext); this.view = view; view.PassViewDepartmentData += View_AddDepartment; view.LoadViewDepartmentData += LoadDepartments; }
private void LoadDepartments() { try { queryDepartment = mycontext.DEPARTMENT; this.view.DataToBindingSource(queryDepartment); } catch (Exception ex) { Console.WriteLine("Error: " + ex.StackTrace); } } |
|
|
Th69
      

Beiträge: 4796
Erhaltene Danke: 1059
Win10
C#, C++ (VS 2017/19/22)
|
Verfasst: Mi 10.12.08 12:39
C#-Quelltext 1: 2: 3:
| LoadDepartments();
this.view = view; |
Dies sagt ja wohl alles!
Und wenn nicht, dann überleg mal, worauf du in LoadDepartments() zugreifst...
|
|
Nally 
      
Beiträge: 46
|
Verfasst: Mi 10.12.08 13:39
Th69 hat folgendes geschrieben : | C#-Quelltext 1: 2: 3:
| LoadDepartments();
this.view = view; |
Dies sagt ja wohl alles!
Und wenn nicht, dann überleg mal, worauf du in LoadDepartments() zugreifst... |
OMG HAHA ja auf was zugreifen was eigentlich noch net da ist , ist weniger toll
jetzt geht zwar die LoadDepartments() doch wenn ich nun ein Department hinzufüge mit der Add methode, dann passiert beim 1. mal nix auch net im output fenster(keine fehlermeldung etc) ERST beim 2.mal add_button drücken wird ein Fehler gemeldet:
und Zeile 19 ist die Leerzeile nach LoadDepartments() Aufruf, komisch warum passiert da ne Exception, wenn ich den Add_Departments button klicke?
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83:
| A first chance exception of type 'System.Data.EntityException' occurred in System.Data.Entity.dll 'Company.vshost.exe' (Managed): Loaded 'C:\windows\assembly\GAC_MSIL\System.Transactions.resources\2.0.0.0_de_b77a5c561934e089\System.Transactions.resources.dll' System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http: bei System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave) bei System.Data.Objects.ObjectContext.SaveChanges() bei Company.DepartmentPresenter.View_AddDepartment(String departmentName) in C:\MVPSampleCompany\Company\Company\DepartmentPresenter.cs:Zeile 46. bei Company.MainWindowView.addDepartmentButton_Click_1(Object sender, EventArgs e) in C:\MVPSampleCompany\Company\Company\MainWindowView.cs:Zeile 27. bei System.Windows.Forms.Control.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) bei System.Windows.Forms.Control.WndProc(Message& m) bei System.Windows.Forms.ButtonBase.WndProc(Message& m) bei System.Windows.Forms.Button.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.Run(Form mainForm) bei Company.Program.Main() in C:\MVPSampleCompany\Company\Company\Program.cs:Zeile 19. bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.Data.EntityException: Fehler beim zugrunde liegenden Anbieter auf Commit. ---> System.Data.SQLite.SQLiteException: SQLite error cannot commit transaction - SQL statements in progress bei System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) bei System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) bei System.Data.SQLite.SQLiteDataReader.NextResult() bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() bei System.Data.SQLite.SQLiteTransaction.Commit() bei System.Data.EntityClient.EntityTransaction.Commit() --- Ende der internen Ausnahmestapelüberwachung --- bei System.Data.EntityClient.EntityTransaction.Commit() bei System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave) bei System.Data.Objects.ObjectContext.SaveChanges() bei Company.DepartmentPresenter.View_AddDepartment(String departmentName) in C:\MVPSampleCompany\Company\Company\DepartmentPresenter.cs:Zeile 46. bei Company.MainWindowView.addDepartmentButton_Click_1(Object sender, EventArgs e) in C:\MVPSampleCompany\Company\Company\MainWindowView.cs:Zeile 27. bei System.Windows.Forms.Control.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) bei System.Windows.Forms.Control.WndProc(Message& m) bei System.Windows.Forms.ButtonBase.WndProc(Message& m) bei System.Windows.Forms.Button.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.Run(Form mainForm) bei Company.Program.Main() in C:\MVPSampleCompany\Company\Company\Program.cs:Zeile 19. bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart()</ExceptionString><InnerException><ExceptionType>System.Data.SQLite.SQLiteException, System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139</ExceptionType><Message>SQLite error cannot commit transaction - SQL statements in progress</Message><StackTrace> bei System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) bei System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) bei System.Data.SQLite.SQLiteDataReader.NextResult() bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() bei System.Data.SQLite.SQLiteTransaction.Commit() bei System.Data.EntityClient.EntityTransaction.Commit()</StackTrace><ExceptionString>System.Data.SQLite.SQLiteException: SQLite error cannot commit transaction - SQL statements in progress bei System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) bei System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) bei System.Data.SQLite.SQLiteDataReader.NextResult() bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() bei System.Data.SQLite.SQLiteTransaction.Commit() bei System.Data.EntityClient.EntityTransaction.Commit()</ExceptionString></InnerException></Exception></TraceRecord> |
|
|
Nally 
      
Beiträge: 46
|
Verfasst: Mi 10.12.08 16:44
also irgendwie scheint sqlite + entity framework schrott zu sein. Habe nun der Department Table einen department_id PK auto_increment spendiert und kann munter hinzufügen ohne Fehler. Nur wird nach dem adden zur ListBox nichts neues darin gezeigt?? Wie gesagt das Hinzufügen in die Datenbank klappt, nur nicht in die ListBox?
Sieht jemand mehr wie ich?
|
|
JüTho
      
Beiträge: 2021
Erhaltene Danke: 6
Win XP Prof
C# 2.0 (#D für NET 2.0, dazu Firebird); früher Delphi 5 und Delphi 2005 Pro
|
Verfasst: Mi 10.12.08 17:10
Nally hat folgendes geschrieben : | also irgendwie scheint sqlite + entity framework schrott zu sein. |
Welchen SQLite Provider hast Du denn? Ich habe gerade hier gelesen, dass der Finiar Provider veraltet ist und besser einer von SourceForge verwendet werden sollte. Vielleicht hilft Dir das.
Jürgen
|
|
Nally 
      
Beiträge: 46
|
Verfasst: Mi 10.12.08 17:19
JüTho hat folgendes geschrieben : | Nally hat folgendes geschrieben : | also irgendwie scheint sqlite + entity framework schrott zu sein. |
Welchen SQLite Provider hast Du denn? Ich habe gerade hier gelesen, dass der Finiar Provider veraltet ist und besser einer von SourceForge verwendet werden sollte. Vielleicht hilft Dir das.
Jürgen |
genau den benutze ich aber...
SQLite for ADO.NET 2.0 - 1.0.60.0
Last Update: Oct 04 2008
sprich den neuesten von SourceForge.
Hab das auch mit SQL CE 3.5 probiert der gleiche Mist bzw. gleiche EntityException wie bei SQLite.
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83:
| A first chance exception of type 'System.Data.EntityException' occurred in System.Data.Entity.dll 'Company.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Transactions.resources\2.0.0.0_de_b77a5c561934e089\System.Transactions.resources.dll' System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http: bei System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave) bei System.Data.Objects.ObjectContext.SaveChanges() bei Company.DepartmentPresenter.View_AddDepartment(String departmentName) in C:\MVPSampleCompany\Company\Company\DepartmentPresenter.cs:Zeile 45. bei Company.MainWindowView.addDepartmentButton_Click_1(Object sender, EventArgs e) in C:\MVPSampleCompany\Company\Company\MainWindowView.cs:Zeile 27. bei System.Windows.Forms.Control.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) bei System.Windows.Forms.Control.WndProc(Message& m) bei System.Windows.Forms.ButtonBase.WndProc(Message& m) bei System.Windows.Forms.Button.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.Run(Form mainForm) bei Company.Program.Main() in C:\MVPSampleCompany\Company\Company\Program.cs:Zeile 19. bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.Data.EntityException: Fehler beim zugrunde liegenden Anbieter auf Commit. ---> System.Data.SQLite.SQLiteException: SQLite error cannot commit transaction - SQL statements in progress bei System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) bei System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) bei System.Data.SQLite.SQLiteDataReader.NextResult() bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() bei System.Data.SQLite.SQLiteTransaction.Commit() bei System.Data.EntityClient.EntityTransaction.Commit() --- Ende der internen Ausnahmestapelüberwachung --- bei System.Data.EntityClient.EntityTransaction.Commit() bei System.Data.Objects.ObjectContext.SaveChanges(Boolean acceptChangesDuringSave) bei System.Data.Objects.ObjectContext.SaveChanges() bei Company.DepartmentPresenter.View_AddDepartment(String departmentName) in C:\MVPSampleCompany\Company\Company\DepartmentPresenter.cs:Zeile 45. bei Company.MainWindowView.addDepartmentButton_Click_1(Object sender, EventArgs e) in C:\MVPSampleCompany\Company\Company\MainWindowView.cs:Zeile 27. bei System.Windows.Forms.Control.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnClick(EventArgs e) bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) bei System.Windows.Forms.Control.WndProc(Message& m) bei System.Windows.Forms.ButtonBase.WndProc(Message& m) bei System.Windows.Forms.Button.WndProc(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) bei System.Windows.Forms.Application.Run(Form mainForm) bei Company.Program.Main() in C:\MVPSampleCompany\Company\Company\Program.cs:Zeile 19. bei System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() bei System.Threading.ThreadHelper.ThreadStart_Context(Object state) bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) bei System.Threading.ThreadHelper.ThreadStart()</ExceptionString><InnerException><ExceptionType>System.Data.SQLite.SQLiteException, System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139</ExceptionType><Message>SQLite error cannot commit transaction - SQL statements in progress</Message><StackTrace> bei System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) bei System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) bei System.Data.SQLite.SQLiteDataReader.NextResult() bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() bei System.Data.SQLite.SQLiteTransaction.Commit() bei System.Data.EntityClient.EntityTransaction.Commit()</StackTrace><ExceptionString>System.Data.SQLite.SQLiteException: SQLite error cannot commit transaction - SQL statements in progress bei System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) bei System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) bei System.Data.SQLite.SQLiteDataReader.NextResult() bei System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) bei System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) bei System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() bei System.Data.SQLite.SQLiteTransaction.Commit() bei System.Data.EntityClient.EntityTransaction.Commit()</ExceptionString></InnerException></Exception></TraceRecord> |
|
|
Nally 
      
Beiträge: 46
|
Verfasst: Mi 10.12.08 22:35
endlich fehler gefunden...
C#-Quelltext 1: 2: 3: 4:
| public void DataToBindingSource(Object queryDepartment) { dEPARTMENTBindingSource.DataSource = queryDepartment; } |
wie Ihr seht habe ich ObjectQuery ersetzt durch Object, denn wenn ich eine Department adde und den context neue abfrage mit:
this.view.DataToBindingSource(queryDepartment.Execute(MergeOption.AppendOnly));
gibt mir queryDepartment kein ObjectQuery zurück sondern ObjectResult, da das Laden der Departments in Vergleich zum adden der Departments aber ObjectQuery zurückgibt und ich nur eine Binding methode möchte habe ich als Parameter eben Object genommen ^^ dann geht es - komisch, denn die Exception trat bei SaveChanges() auf was vor der binding methode liegt... sehr merkwürdig.
Moderiert von Christian S.: C#-Tags hinzugefügt
|
|
|