c# - Sqlite error WP8.1 -
i'm developing windows phone 8.1 app. have problem sqlite database. created one, , made file. want use file in app, , data it.
i did create this:
sqliteconnection.createfile(@"c:\probaprobe\mysql.sqlite"); sqliteconnection m_dbconnection; m_dbconnection = new sqliteconnection("data source=c:\probaprobe\mysql.sqlite;version=3;"); m_dbconnection.open(); string sql = "create table highscores (name varchar(20), score int)"; sqlitecommand command = new sqlitecommand(sql, m_dbconnection); command.executenonquery();
and inserted data insert statment. works nice. now, when want use mysql.sqlite in windows phone 8.1 app, have problems. did way:
private async task copydatabase() { string db_path = path.combine(@"c:\probaprobe\mysql.sqlite"); bool isdatabaseexisting = false; using (var db = new sqlite.sqliteconnection(db_path)) { isdatabaseexisting = true; grad q = new grad(); sqlitecommand sqlcomm = new sqlitecommand(db); string = (db.query<grad>("select * grad")[0]).ime; catch { isdatabaseexisting = false; } }
problem is: not open database file: c:\probaprobe\mysql.sqlite (cannotopen)
i think i'm missing something... anyone? thx
you can't access system directories on windows phone. applications on wp work in sandbox, can access local storage available application.
you use connection string (local database windows phone 8):
isostore:/mysql.sqlite
if need copy database file phone's or emulator's storage use windows power tools.
Comments
Post a Comment