ich einfügen in eine Oracle-DB Tabelle den folgenden Einsatz Zeichenfolge mit (ca. - dort ist 140 Spalten, so zeige ich es nicht alle):Oracle Umwandlung ISO Date Computer locale Datum/Uhrzeit
„INSERT INTO AMS_ASSET_CS_IFACEOUT WERTE ('abcdef', 'abcdef', bis_datum ('2010-01-31', 'JJJJ-MM-TT'), ...) "
Dann ein paar Sekunden später führe ich das folgende Code-Snippet aus :
/// <summary>
/// Function: GetRecord
/// Description: Creates a new AMS-Asset and populates the
/// properties of this asset by evaluating properties provided
/// by the OracleDataReader.
/// </summary>
/// <param name="reader"> One record of information from the open connection.</param>
/// <returns> A fully created AMS-Asset record. </returns>
private static AmsAsset GetRecord(OracleDataReader reader)
{
AmsAsset newRecord = new AmsAsset();
for (int propertyIndex = 0; propertyIndex < reader.FieldCount; propertyIndex++)
{
string propertyName = reader.GetName(propertyIndex).ToLower();
string propertyValue = reader.GetValue(propertyIndex).ToString();
int propertyValueAsInteger = 0;
bool isPropertyAnInteger = Int32.TryParse(propertyValue, out propertyValueAsInteger);
if (isPropertyAnInteger)
{
newRecord.GetType().GetProperty(propertyName).SetValue(newRecord, propertyValueAsInteger, null);
}
else
{
newRecord.GetType().GetProperty(propertyName).SetValue(newRecord, propertyValue, null);
}
}
return newRecord;
}
Das Datum Wert ich in meiner Datenbank eingefügt wird nun als zurück „2010.01.31 00.00.00.“
Ich bin mir nicht ganz sicher warum ... Was sind meine Optionen? Muß ich nur eine Umwandlung von dem Format Code, den ich werde wieder in ISO gegeben
Grüße,
Sean Anderson
Nur zur Bestätigung, wäre dies ein akzeptables Mittel zur Behebung dieses Problems? [IgnoreFirst] [DelimitedRecord ("")] [Serializable] public class AmsAsset { public string assetnum {get; einstellen; } public string changeby {get; einstellen; } public string changeate { erhalten { Rückgabe String.Format ("{0: YYYY-MM-DD}", geändert); } gesetzt { } } .... EDIT: Ehh, Formatierung schrecklich stellte sich heraus. Ich werde es aber reparieren. VIELEN DANK! –