Sqlite: check if database exist

后端 未结 3 1020
野的像风
野的像风 2021-01-19 02:47

I am developing a mobile application using phonegap that store some data into the local database (sqlite DB). I need to know if the database exist or not, and that to determ

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-19 03:04

    The best way for determining if the DB exists or not is to check if the file that represents it exists. This is a simple IO operation, like the following example:

    string path = Path.Combine(ApplicationData.Current.LocalFolder.Path, databaseName);

    if (File.Exists(path)) { //your code here }

提交回复
热议问题