Make SQLite connection fail if database is missing? (deleted/moved)

前端 未结 6 583
终归单人心
终归单人心 2021-01-18 11:39

I have the following method inside class DBConnection. I call the method like this: SQLiteConnection conn = DBConnection.OpenDB(); when I want to o

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-18 12:19

    If there is no way to change the default SQLite behavior, then you might have to do a File.Exists. That would be better than connecting and creating a new file, checking to see if it's the database you want, then deleting the new file in the catch block.

提交回复
热议问题