0

I've already searched around and so far, what I've found isn't working for some reason :\

string connection = "Data Source=DB.db;Version=3;Pooling=True;Max Pool Size=100;";
SQLiteConnection sqlc = new SQLiteConnection(connection);
sqlc.Open();  
sqlc.SetPassword("password");

sqlc.Close();

Gives me the error

An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: 'The invocation of the constructor on type 'Hotel_Manager.MainWindow' that matches the specified binding constraints threw an exception.' Line number '3' and line position '9'.

Can someone tell me what I'm doing wrong?

Note that I already have a program that interacts with the DB working. It's only now that I'm trying to password protect it.

Lorenzo Ang
  • 1,202
  • 3
  • 12
  • 35
  • That error has nothing to do with SQLite. I would hazard a guess that there's an error in your XAML. Does the code run if you comment out the SQLite bits? – Dean Ward Feb 08 '15 at 13:35
  • It works perfectly if I take out the `sqlc.SetPassword("password");` bit :\ – Lorenzo Ang Feb 08 '15 at 13:40
  • Can you update with the full text of that exception? Suspect the inner exception will give an answer here... – Dean Ward Feb 08 '15 at 13:42
  • @DeanWard Just did! It basically points to the line the password bit is at. – Lorenzo Ang Feb 08 '15 at 13:46
  • @Lloyd I'm pretty sure it doesn't work that way? :)) But thanks anyway! :) – Lorenzo Ang Feb 08 '15 at 13:51
  • @Dilisqq that still isn't the full exception; need the full stack trace... I think you might need to call ChangePassword. See answer to http://stackoverflow.com/questions/1381264/password-protect-a-sqlite-db-is-it-possible – Dean Ward Feb 08 '15 at 13:51
  • JUST FIGURED IT OUT! @DeanWard It should be sqlc.ChangePasword() not sqlc.SetPassword(). How stupid of me ~_~ – Lorenzo Ang Feb 08 '15 at 13:51
  • @DeanWard Funny, we typed it out together at the same time haha. But yeah, that's the right answer. Thanks for helping me out! :) – Lorenzo Ang Feb 08 '15 at 14:00

0 Answers0