views:

201

answers:

1

Hello , I use this code and SQLite says "Data Source cannot be empty. Use :memory: to open an in-memory database"

here is my code

 string dbfile = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + "\\m23.db";

        string sql;

        DateTime dt = DateTime.Now;
        SQLiteConnection connection = new SQLiteConnection("datasource="+ dbfile);

        SQLiteDataAdapter adapter = new SQLiteDataAdapter("select * from p_posts", connection);
        DataSet data = new DataSet();
        adapter.Fill(data); //  <<< here i get the error

        SQLiteCommand cmd = new SQLiteCommand();
        cmd.CommandType = CommandType.TableDirect;
        cmd.Connection = connection;

        connection.Open();

Any help is apreciated , Cheers !

+1  A: 

Try using

SQLiteConnection connection = new SQLiteConnection("Data Source=" + dbfile);

The examples I've seen use "Data Source" instead of "datasource".

Jon Skeet
It works ! , but now it says my table doenst exist o.O
Aviatrix