Looks like you trying to use Linq2Sql with Sqlite which isn't supported by default (only SQL Server and SQL Server CE are supported), see this question for more details.
Have a look at using Entity Framework, which supports Sqlite, instead.
I just went through this and tried to implement. Got same error, then found that we can create database using
SQLiteConnection as so:
And then using "db" you can do all database operation. Try it.
I have found this to work for me.
string fileDB = "Data Source=:memory:"; Console.WriteLine(fileDB); SQLiteConnection conn = new SQLiteConnection(fileDB); DataContext db = new DataContext(conn); Console.WriteLine(db.Connection.ServerVersion);
Using a file, credits to this guy for the file path.
string fileDB = "Data Source=" + Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName + @"\test.sqlite";
First check the company example of Linq2SQL here.
- Creating database using DataContext and System.Data.SQLite in C#
- how to fetch data from database using linq query for relationship 1:N and N:N (between 3 entity) in asp.net mvc EF code first?
- how to convert Database Hierarchical Data to XML using ASP.net 3.5 and LINQ
- Is a full list returned first and then filtered when using linq to sql to filter data from a database or just the filtered list?
- creating Linq to sqlite dbml from DbLinq source code
- can't save data to database using ajax and linq
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- How to show 2nd row on Data in Next Button Click in C# and XML database using LINQ
- Using LINQ to iterate through a database and generate a generic XML layout of schema + data
- how to insert data in 1 table and update another table in a sql database using linq
- Reading data from xml and writing in database using C#
- Using a integer obtained from a database and using it to retrieve some data from database using Linq
- Get data from database using linq query and display it in dynamically generated labels in repeater
- Using a Data Table, how do I check if the data matches an entry in an Access database and adds the content?
- Querying the database using EF Code First and Linq
- Using SQLite in C#, how to update and work with a generated database file?
- Creating Users and Roles while seeding DB using EF code first
- Query Microsoft Access MDB Database using LINQ and C#
- I am wondering about the state of connection and impact on code performance by 'yield' while iterating over data reader object
- Some data is missing in the Export to Excel using DataTable and Linq
- Access all of the data after joining two tables and group them using linq
- Retrieving Data from database within the last 7 days using linq
- How much is too much data for and XML file, and what are some file based database alternatives?
- Error using System.Data.Linq.Mapping and auto incrementing the primary key in a sqlite db
- Linq To XML - Using XDocument and creating list of objects
- Creating UI and database dynamically, what is the best approach?
- How can I code an outer join using LINQ and EF6?
- Asp.net mvc3: How to pull data from database and fill view model in one goal?
- How to bind data from mutiple tables to datagridview using Entity Framework and use CRUD operations?
- How to filter data in a list using multiple conditions and LINQ?
More Query from same tag
- Write a LINQ query to get count on a boolean sharepoint2010 field
- Is XML Elements Attribute value always data type of string?
- is it possible to use Take in LINQ when the query returns an anonymous type?
- LINQ and Grouping from a simple SQL DB relationship
- How to add empty groups to a Linq query result set?
- C# Linq group by DateTime ignore hours and minutes
- Casting Linq to IEnumerable <Datarow>
- Efficiency of LINQ in simple operations
- Select only the values present multiple times in a list C# Linq
- Linq in datatable or data set
- How to select data in rows using LINQ?
- Select from or filter in an IEnumerable in the view
- Continued filtering/querying on a group by into object?
- Convert custom delimited string to List<myClass>?
- compare the dates with linq
- Invalid Date whilst using Moment() and Linq
- Linq Error : Invalid 'where' condition. An entity member is invoking an invalid property or method
- cannot implicitly convert type system.collections.generic.list to system.collections.generic.IEnumerable
- Ignoring Empty strings when searching with LINQ-to-Entities
- Getting a collection of index values using a LINQ query
- How do I find available rooms using LINQ, when there are more than one of each room type?
- Entity Framework navigation with shared object table
- Searching a list of objects for a non empty property
- LINQ, select with only the first element of child item
- Filtering a UserDefinedFunctionCollection using LINQ?
- How I can order by descending and then take some items using linq?
- Complex Query using Sitecore 8 content search API
- c# Sum values of same interval and date and type from datatable
- How to pass lambda expressions as parameter in C#
- Trying to get generic when generic is not available