How to create a db3 database with Sqlite-Net

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 20:17:33

问题


In a mono project I want to create a database and use that, and Sqlite-Net is optimzied for mono so would go with that. But I cant find any documentation how to create a database with it. So I just try to connect to it and hope it will say "Database dont exists, I will create one" but I get an exception so that approch dont work

readonly string _pathToDatabase = "Meter_db.db3";
public InstallMeterRepository()
{
    if(!File.Exists(_pathToDatabase))
    {                
        using (var conn = new SQLite.SQLiteConnection(_pathToDatabase))
        {                   
            conn.CreateTable<InstalledMeter>();
        }
    }
}

回答1:


If you want to create a new database, you need the driver: http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

You can check here too: http:// sqlite.phxsoftware.com/

And with this FREEWARE manager, you can do whatever you want with your database: (Recomended!) SQLite2009 Pro Enterprise Manager http://osenxpsuite.net/?xp=3&uid=managementtools

Happy develop!

Fear



来源:https://stackoverflow.com/questions/13176710/how-to-create-a-db3-database-with-sqlite-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!