当我尝试连接SQLite数据库时,程序正在等待,什么都不做。这是我的代码:
class DAO
{
private static readonly String connectionString = @"Data Source=D:\database.db;Version=3;";
public String GetConfig(String key)
{
String value = "";
using (SQLiteConnection conn = new SQLiteConnection(connectionString))
{
SQLiteCommand command = conn.CreateCommand();
command.CommandText = "SELECT `value` FROM config WHERE `key`=@key";
command.Parameters.Add("key", System.Data.DbType.String).Value = key;
conn.Open();
object result = command.ExecuteScalar();
if (result != null)
{
value = Convert.ToString(result);
}
}
return value;
}
}
程序正在等待conn.Open();
行,但不会抛出任何错误......
问题在哪里?