0
votes

I am trying to setup entity framework with sqlite in visual studio 2012. So, here is what I have done so far:

  1. Installed System.Data.Sqlite with "Design-Time Component".
  2. Entity Framework Tools for visual studio 2012.
  3. System.Data.SQLite,System.Data.SQLite.EF6 and System.Data.SQLite.Linq from NuGet.

Now I am trying to add "ADO.net Entity Data Model",By following steps:

  1. Add New Item.
  2. ADO.net Entity Data Model.
  3. "EF Designer from Database" from wizard and click "Next".
  4. Add "New Connection", Data Source: System.Data.Sqlite Database File.

After choosing db file and provide password when I click on "Next" button, following error occurs:

enter image description here

I have checked my db file in "Sqlite Browser" also I have setup password for db file with the help of following code:

string conn = @"Data Source=pahtto\App_Data\app_data.sqlite;";
SQLiteConnection connection = new SQLiteConnection(conn);
connection.SetPassword("123456");
connection.Close();

What am I missing?

Please guide me.

Thank you.

2

2 Answers

0
votes

Try looking in your App.config file and change the connection string and set your password there.

old connection string

source=X:projectsmeowdb.sqlite;

modified Connections string

source=X:projectsmeowdb.sqlite;password=this is my password

Look at this link for more information

http://www.dxsdata.com/2013/09/visual-studio-with-sqlite-solving-error-file-is-encrypted-or-not-a-database/

0
votes

It seems that the problem was in my db file even though it was working fine in "Sqlite Browser".

So, I just deleted and created new file and every thing works.