Cannot connect to SQLlIte in .NET


I placed sqllite file in App_Data the file name is logindb.

When I try to open the file it gives error

   // Create a new database connection:
            sqlite_conn = new SQLiteConnection("|DataDirectory|logindb");
Microsoft Technologies based on the .NET software framework.
3,543 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
3,383 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 30,551 Reputation points MVP


    in the constructor the connectionstring to the database file must be provided.

    The path you demonstrate does to seems to be a valid path, because of the pipe (|) characters.

    Try forward or backward slashes for a change.

    Next to that, I recommend testing if the file exists:

    string curFile = @"c:\temp\test.txt";
    Console.WriteLine(File.Exists(curFile) ? "File exists." : "File does not exist.");

    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments