0

当我尝试连接程序正在等待的 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();在线等待,但没有抛出任何错误......问题出在哪里?

4

0 回答 0