tags:

views:

19

answers:

1

I used

http://sqliteadmin.orbmu2k.de/

to create my sqlite db file. I created it as a sqlite db version 3 file.

When I go to open the connection

Dim Connection As New SQLite.SQLiteConnection(DATABASE_FILE_LOCATION)
Connection.Open()

I am getting this exception on the Open() call

"File opened that is not a database file file is encrypted or is not a database" (System.Data.SQLite.SQLiteException) Exception Message = "File opened that is not a database file\r\nfile is encrypted or is not a database", Exception Type = "System.Data.SQLite.SQLiteException"

What is the issue here? Here is my file file location constant:

Private Const DATABASE_FILE_LOCATION As String = "Data Source=C:\Users\Scott\Desktop\Projects\Funds\Program\BudgetManager\Main.s3db;Version=3;"
A: 

Hello, you could adapt this c# to vb:

private void showTables()
{
   SQLiteConnection cn = new SQLiteConnection("Data Source=myDatabase.db3");
   try
   {
        cn.Open();
        cn.SetPassword("MyPassword");
        DataTable tables = cn.GetSchema("Tables");
        Console.WriteLine("I have {0} tables", tables.Rows.Count);
        cn.Close();
   }
   catch (SQLiteException ex)
   {
       Console.WriteLine(ex.ToString());
   }
}

Does your database have a password? You can tell database you have a password by changing the string:

SQLiteConnection cn = new 
SQLiteConnection("D:\Programming\Test\myDatabase.db3;Password=mypassword");

Always remember to double check if everything is installed (http://sqlite.phxsoftware.com/) and you have right permissions on this database file.

If you are sure file is not encrypted, reinstall http://www.sqlite.org/cvstrac/wiki?p=ManagementTools

Junior Mayhé
No PW on the Database and it doesn't even pass the Open() command.
Scott
I hope it is not a corrupted database, versions mismatch. You could try to see if you have all up to date SQLite ADO.NET Provider, latest SQLite-X.X.XX.X-setup.exe, also try this SQLite Odbc Driver. Also check this out http://www.kirupa.com/net/sqllite_vb_pg1.htm
Junior Mayhé