I know this error has been reported before in similar (but different) scenarios:
"Error: "Unable to load DLL 'sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E"
In this case, it's an intellisense only issue I cannot seem to resolve. Everything works fine (I can execute sql queries etc) aside from the error. This seems like some kind of bug. The question, is why/where and can I resolve?
Here's what I did:
Example:
<Window x:Class="myapp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:myapp"
xmlns:viewModels="clr-namespace:myapp.ViewModels"
Name="Editor"
mc:Ignorable="d"
Title="Package Creator" Height="600" Width="800">
<Window.DataContext>
<viewModels:ViewModelEditor/>
</Window.DataContext>
<Grid>
</Grid>
</Window>
Where the ViewModel looks something like this:
enter code here
using myapp.Models;
namespace myapp.ViewModels
{
public class ViewModelEditor : ViewModelBase
{
public ViewModelEditor()
{
this.ViewYears = new Models.ModelYears();
}
private ModelYears viewYears;
public ModelYears ViewYears
{
get { return viewYears; }
set { viewYears = value; }
}
}
}
and the model looks like....
public class ModelYear
{
[Key]
public int YearID { get; set; }
}
public class ModelYears : ObservableCollection<ModelYear>
{
public ModelYears()
{
SQLiteConnection conn = new SQLiteConnection(Properties.Settings.Default.DBPath);
using (conn)
{
try
{
var results = conn.Query<ModelYear>("SELECT YearID FROM YEARMODEL ym ORDER BY YearID;");
foreach (ModelYear r in results)
{
this.Add(r);
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
User contributions licensed under CC BY-SA 3.0