S
S
sergeyfk2017-10-30 10:17:15
SQLite
sergeyfk, 2017-10-30 10:17:15

Why is an exception thrown when trying to declare a SQLiteConnection?

It crashes on the line marked with a comment, the file is being created, the path is correct, many extensions have been tried (*.sqlite, *.db, *db3, etc.).
Here is the code:

if (File.Exists(savepath))
            {
                File.Delete(savepath);
            }
            SQLiteConnection.CreateFile(savepath);
            SQLiteConnection connection = new SQLiteConnection(); //исключение
            connection.ConnectionString = (String.Format("Data Source = {0}; Vesion = 3;",savepath));

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergeyfk, 2017-10-30
@sergeyfk

Solution: Include System.Windows.Forms

C
cicatrix, 2017-10-30
@cicatrix

What's the exception, what's the error message?
Now tried "empty project" with one line:
No exceptions were thrown.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question