Reputation: 11
Bear with me, I'm new to databases.
I have an Access database, "Database.accdb". It's located on my local computer: "C:\Users\MyUserName\Documents\Database.accdb". I have a C# program trying to establish a connection with this database.
I attempt to create a class derived from DbLinq Datacontext.
namespace DatabaseTest.Database
{
public partial class DatabaseTestDataContext : DataContext
{
public DatabaseTestDataContext()
: base(@"C:\Users\MyUserName\Documents\Database.accdb")
{ }
#region Tables
public Table<Tables.TestTable> TestTable { get { return GetTable<Tables.TestTable>(); } }
#endregion
}
}
I attempt to query the database like this:
var TTDB = new DatabaseTest.Database.DatabaseTestDataContext();
var collection = from x in TTDB.TestTable
where x.TestID == "A003"
select x;
foreach (var item in collection)
{
MessageBox.Show(item.Part);
}
Running this code results in the following error:
System.ArgumentException: 'Unable to load the `DbLinq.SqlServer' DbLinq vendor within assembly 'SqlServer.dll'.'
Inner Exception FileNotFoundException: Could not load file or assembly 'DbLinq.SqlServer' or one of its dependencies. The system cannot find the file specified.
Basically, I am not completely sure how to connect to an Access Database (located on my personal computer) using the DBLINQ DataContext. Perhaps I am simply missing a reference? Any suggestions?
Upvotes: 1
Views: 60