来自NuGet Mono.Data.Sqlite的Xamarin Forms和Mono.Data.Sqlite.SqliteDataReader行为不端

时间:2016-05-04 16:50:51

标签: c# android sqlite xamarin xamarin.forms

我有一个关于Xamarin Forms C#Mono.Data.Sqlite.SqliteDataReader行为不端的问题。编译到Android平台时,以下代码可以正常工作:

              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();

但是,如果我这样做,则返回的数据不合适地为null: - " as string"和" Convert.ToInt64"对于"多久? ?? -100"值 - "作为int? ?? -100" for" Convert.ToInt16 .. as string"值

任何人都可以解释这种行为吗?手动检查底层SQLite数据库会发现存在适当的数据。

使用Xamarin Forms 2.2.0.31(最新稳定版)的Mono.Data.Sqlite.Portable NuGet 1.0.3.5(最新稳定版)。

0 个答案:

没有答案