【发布时间】:2011-05-14 20:47:45
【问题描述】:
当我尝试访问具有内置架构的有效 SQLiteConnection 上的附加 db 文件时,我收到“没有这样的表”错误。
在“主”连接上保存一些测试数据后,我附加文件,然后尝试将数据从“主”导出到文件以供以后使用。这是用于附加文件的代码:
private static void _attachDatabase(SQLiteConnection conn, string dataFile) {
var cmd = new SQLiteCommand(conn)
{
CommandText = string.Format("ATTACH '{0}' AS {1}", dataFile, ATTACHED_DB)
};
_log.Debug(cmd.CommandText);
cmd.ExecuteNonQuery();
}
命令的日志输出为
"...\bin\Debug\testData.db3' AS asdf" where testData.db3 is the file.
但是,当我尝试插入文件时,我在这篇文章的末尾收到错误消息。
有没有人从提供的信息中看到问题?顺便说一句,我应该能够在调试器的某处看到附加的数据库(“asdf”)吗?
干杯,
浆果
测试“SQLiteTesting.Helpers.QueryTests.Director_if_Tim_Burton_query_should_return_one_movie”失败:QueryTests 中的 TestFixtureSetUp 失败
TestFixture 失败:System.Data.SQLite.SQLiteException:SQLite 错误 没有这样的表:asdf.ActorRole 在 System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn,String strSql,SQLiteStatement previous,UInt32 timeoutMS,String& strRemain) 在 System.Data.SQLite.SQLiteCommand.BuildNextCommand() 在 System.Data.SQLite.SQLiteCommand.GetStatement(Int32 索引) 在 System.Data.SQLite.SQLiteDataReader.NextResult() 在 System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd,CommandBehavior 行为) 在 System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior 行为) 在 System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() 在 SQLiteTesting.Helpers.SQLiteLoader._copyTableData(SQLiteConnection conn, String source, String destination) 在 C:\Users\Lord & Master\Documents\Projects\Data\NHib projects\Cookbook\SQLiteTesting\Helpers\SQLiteLoader.cs:line 68 在 SQLiteTesting.Helpers.SQLiteLoader.ExportData(SQLiteConnection conn, String dataFile) 在 C:\Users\Lord & Master\Documents\Projects\Data\NHib projects\Cookbook\SQLiteTesting\Helpers\SQLiteLoader.cs:line 30 在 C:\Users\Lord & Master\Documents\Projects\Data\NHib projects\Cookbook\SQLiteTesting\Helpers\QueryTests.cs:line 25 中的 SQLiteTesting.Helpers.QueryTests.OnFixtureSetUp() 在 C:\Users\Lord & Master\Documents\Projects\Data\NHib projects\Cookbook\SQLiteTesting\Helpers\BaseFixture.cs:line 23 中的 SQLiteTesting.Helpers.BaseFixture.FixtureSetUp() 2010-11-23 18:15:36,835 DEBUG ATTACH '...\bin\Debug\testData.db3' AS asd 2010-11-23 18:18:12,935 调试插入 asdf.ActorRole SELECT * FROM ActorRole
【问题讨论】:
标签: c# nhibernate sqlite