I am trying to connect to a sqllite db from with a c# application. I have never worked with SQLLite before.
var connectionString = @"data source='C:\TestData\StressData.s3db'";
connection = new SQLiteConnection(connectionString);
connection.Open();
When i attempt to open the connection I get the following exception:
System.NotSupportedException: The given path's format is not supported.
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
What am I doing wrong?
Thanks..
Nick
Update:
I changed 'data source' to 'DataSource' as suggested to me. Now I receive a new error:
After changing this I get a new error: System.ArgumentException: Data Source cannot be empty. Use :memory: to open an in-memory database at System.Data.SQLite.SQLiteConnection.Open()
Any more suggestions?
Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.
Start the sqlite3 program by typing "sqlite3" at the command prompt, optionally followed by the name the file that holds the SQLite database (or ZIP archive). If the named file does not exist, a new database file with the given name will be created automatically.
Got it..
"data source=c:\TestData\StressData.s3db; Version=3;"
Looks like the 'Version' attribute is not optional. Interesting that the .NET provider does not show this in the designer property window.
According to this, data source
should be DataSource
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With