I have a question about Xamarin Forms C# Mono.Data.Sqlite.SqliteDataReader misbehaving. When compiled to the Android platform the following code works correctly:
SqliteDataReader c = contents.ExecuteReader();
//Debug.WriteLine("Reading data");
if (c.HasRows)
{
c.Read();
q = new SA_Question(
c[SA_AWSConstants.tq_questionguid_text] as string,
c[SA_AWSConstants.tq_order_int_primarykey] as long? ?? -100,
c[SA_AWSConstants.tq_json_text] as string,
c[SA_AWSConstants.tq_finalresponseid_int] as long? ?? -100,
c[SA_AWSConstants.tq_final_response_str] as string,
Convert.ToInt16(c[SA_AWSConstants.tq_answered_intbool] as string),
Convert.ToInt16(c[SA_AWSConstants.tq_uploaded_intbool] as string)
);
}
c.Close();
However, the data returned is inappropriately null if I do: - "as string" and "Convert.ToInt64" for the "as long? ?? -100" values - "as int? ?? -100" for the "Convert.ToInt16 .. as string" values
Can anyone explain this behavior? Manual inspection of the underlying SQLite database reveals presence of appropriate data.
Mono.Data.Sqlite.Portable NuGet 1.0.3.5 (latest stable) with Xamarin Forms 2.2.0.31 (latest stable).
Aucun commentaire:
Enregistrer un commentaire