0

When I try to connect the SQLite database the program is waiting, do nothing. Here my code:

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;
    }
}

The program is waiting on conn.Open(); line, but doesn't throw any errors... Where is the problem?

MrRP
  • 822
  • 2
  • 10
  • 25

0 Answers0