我們正在使用Visual Studio 2010時失去sqlite的表,MonoDroid的和SQLite部署到MonoDroid的
我們在創建使用SqliteConnection.CreateFile(路徑myContext.GetDatabasePath( 「mydb.db3」)。AbsolutePath的數據庫。 ..) 方法。
所以我們的連接字符串是「Data Source =/data/data/myapp.myapplication/databases/mydb.db3temp;」
我們創建一個表並使用SqliteCommand.ExecuteNonQuery()插入多條記錄。
我們可以在插入後立即使用SqliteCommand.ExecuteScalar()運行選擇查詢。
SqliteDataAdapter.Fill(表)方法並不成功運行,併爲我們提供了這個異常:
System.EntryPointNotFoundException: sqlite3_column_origin_name
at (wrapper managed-to-native) Mono.Data.Sqlite.UnsafeNativeMethods:sqlite3_column_origin_name (intptr,int)
at Mono.Data.Sqlite.SQLite3.ColumnOriginalName (Mono.Data.Sqlite.SqliteStatement stmt, Int32 index) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteDataReader.GetSchemaTable (Boolean wantUniqueInfo, Boolean wantDefaultValue) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteDataReader.GetSchemaTable() [0x00000] in <filename unknown>:0
at System.Data.Common.DataAdapter.BuildSchema (IDataReader reader, System.Data.DataTable table, SchemaType schemaType, MissingSchemaAction missingSchAction, MissingMappingAction missingMapAction, System.Data.Common.DataTableMappingCollection dtMapping) [0x00000] in <filename unknown>:0
at System.Data.Common.DataAdapter.BuildSchema (IDataReader reader, System.Data.DataTable table, SchemaType schemaType) [0x00000] in <filename unknown>:0
at System.Data.Common.DataAdapter.FillTable (System.Data.DataTable dataTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, System.Int32& counter) [0x00000] in <filename unknown>:0
at System.Data.Common.DataAdapter.FillInternal (System.Data.DataTable dataTable, IDataReader dataReader) [0x00000] in <filename unknown>:0
at System.Data.Common.DataAdapter.Fill (System.Data.DataTable dataTable, IDataReader dataReader) [0x00000] in <filename unknown>:0
at System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable dataTable, IDbCommand command, CommandBehavior behavior) [0x00000] in <filename unknown>:0
at System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable dataTable) [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Data.Common.DbDataAdapter:Fill (System.Data.DataTable)
at ...
如果我們對應用程序代碼進行任何更改和重新部署,然後將數據庫文件仍然存在在Android設備上但SqliteCommand.ExecuteScalar()和SqliteDataAdapter.Fill(表)會拋出異常是說,表不存在:
Mono.Data.Sqlite.SqliteException: SQLite error
no such table: MyTable
at Mono.Data.Sqlite.SQLite3.Prepare (Mono.Data.Sqlite.SqliteConnection cnn, System.String strSql, Mono.Data.Sqlite.SqliteStatement previous, UInt32 timeoutMS, System.String& strRemain) [0x00000] in <filename unknown>:0
at Mono.Data.Sqlite.SqliteCommand.BuildNextCommand() [0x00000] in <filename unknown>:0
這是預期MonoDroid的行爲嗎?我們是否應該在重新部署應用程序後丟失表格?我們應該如何使用SqliteDataAdapter.Fill()?
感謝
您是否試過拉動設備的數據庫文件,並在數據庫瀏覽器中打開它並查看該表是否存在? –
我以前沒有嘗試過。我現在只是試了一下,表格不存在。 – Joel