'SQLite with actual queries in Xamarin
I am porting over some code from an older mobile application and I was hoping to use SQLite. All the tutorials I could find say to use the sql-net-pcl package. When I do that, I find I cannot really use simple queries and it seems like I must use the ORM. This will vastly increase the amount of work I will have to do because now I cannot directly port the SQL statements.
The following code throws no exception:
/////////////////////////////////////////////////
// Table aaaaaa
try
{
string sql2 =
"XCREATE TABLE aaaaaa ( \n" +
" sync_seq INTEGERXXXXX NOT NULL \n" +
") \n";
con.Execute(sql2, new object[0]);
}
catch (Exception ex)
{
DisplayAlert("Error!", $"{ex.Message}", "OK");
return;
}
And neither does this:
/////////////////////////////////////////////////
// Table allowMO
sql =
"CREATE TABLE allowMO ( \n" +
" flag TEXTXXXX NOT NULL, \n" +
" cap REAL NOT NULL \n" +
") \n";
cmd.CommandText = sql;
_ = cmd.ExecuteNonQuery();
I tried to use the System.Data.SQLite package that I use on the desktop but I get an error about a missing interop file when I create a connection.
"SQLite.Interop.dll assembly: type: member:(null)"
Has anyone used a package that allows for plain old SQL queries?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
