Autor Beitrag
RobAll
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Mi 15.08.18 18:50 
Hallo Leute.

Ich habe eine Abfrage die Funktioniert, bis auf p.WE_Datum -> Spalte WE_Datum ist in der SQL CE Datenbank als DateTime deklariert.
ausblenden C#-Quelltext
1:
2:
var tempListe = context.Tab_Material_Stammdaten
                  .Select(p => new { p.Einzelteilname, p.Tab_Hersteller.Hersteller, p.Einzelteilnummer, p.Einzelteilrevision, p.Info, p.ID, p.WE_Datum });

Zitat:
Fehler: tempListe null System.Linq.IQueryable<<>f__AnonymousType0<string, string, string, string, string, int, System.DateTime?>>


Bitte um Hilfe

Gruß Rob

Moderiert von user profile iconTh69: C#-Tags hinzugefügt
Moderiert von user profile iconTh69: Quote-Tags hinzugefügt
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mi 15.08.18 19:23 
Hallo und :welcome:

du meinst die Abfrage funktioniert ohne p.WE_Datum, aber sobald du diese Spalte hinzufügst, erhältst du keine Daten mehr (null)?

PS: Mußt du denn zwingend mit SQLCE arbeiten, denn dieses wird ja von MS nicht weiter gepflegt? Viele Entwickler sind seither auf SQLite umgestiegen.
RobAll Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Mi 15.08.18 21:23 
-Ich hatte mich für SQLite entschieden und damit gearbeitet. Allerdings kann man dies nicht mit Passwort schützen. Schade. Bin Dann auf SQLCE umgestiegen.

Habt ihr diesbezüglich noch Tipps, bzw. Datenbankempfehlungen?
Ich bin Hobbyentwickler, und arbeite am liebsten ohne Server.

LG
Rob

Moderiert von user profile iconTh69: Vollzitat entfernt.
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Do 16.08.18 08:37 
Du hast aber noch nicht beantwortet, ob ich deine Frage richtig verstanden habe.

Unter How to use default DateTime values with SQL Server CE and Entity Framework (englisch) gibt es evtl. Tipps.

Und bzgl. SQLite und Passwort schau mal in SQLite with encryption/password protection (auch englisch).
RobAll Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 34



BeitragVerfasst: Di 21.08.18 20:07 
Hallo,
ja du hast meine Frage richtig verstanden.
Ich konnte das DateTime Problem nich lösen.

Ich habe jetzt zurück auf SQLite gewechselt.

Danke
Gruß RobAll
Quitzlinga
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60
Erhaltene Danke: 2

Win XP
Delphi 2007 Prof. Codegear Win32
BeitragVerfasst: Mi 22.08.18 08:44 
Hi,

wenn ich das jetzt richtig verstehe ist SQL CE ein MSSQL kompakt. Mit welchem Treiber greifst Du auf die DB zu ? Unter MSSQL gibt bspw. der MSSQL OLE DB Treiber die Date und Datetimetypen als String zurück. Abhilfe schafft da nur der SQL Server Native Client. Hier könnte ein ähnliches Problem vorliegen.

MfG

Quitzlinga
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4700
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Mi 22.08.18 13:46 
Jein. Er benutzt ja EntityFramework(EF). Das legt fest welcher Provider benutzt wird. Für CE gibt (eher eigentlich gab) es direkte native Unterstützung(im System.Data.SqlServerCe Namespace) im Framework und EF benutzt diesen. Da CE ein totes Produkt ist und er scheinbar was neues implementiert ist woanders schauen wohl die beste Lösung. SqlServer LocalDB wäre zum Beispiel eine weitere Alternative.