score:2
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.
score:0
I just went through this and tried to implement. Got same error, then found that we can create database using SQLiteConnection
as so:
sqlcnn.CreateFile("MyDatabase.sqlite");
And then using "db" you can do all database operation. Try it.
score:0
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.
Source: stackoverflow.com
Related Articles
- Creating database using DataContext and System.Data.SQLite in C#
- creating Linq to sqlite dbml from DbLinq source code
- 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?
- Retrieving Data from database within the last 7 days using linq
- 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?
- read icollection data using LINQ in C# code
- updating data in many-to-many relationship in entity framework in code first existing database
- can't save data to database using ajax and linq
- Using LINQ query result for data source for GridControl c#
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- Can't add a new record with an integer value into database by using linq from code C#
- LINQ - database query using "into", how do I reference data prior to "into" in the select clause?
- Using .Include() in a database query creates an infinite loop of data
- Linq query to get data from Database using group by clause
- Insert large amount of data into database using LINQ
- How to show 2nd row on Data in Next Button Click in C# and XML database using LINQ
- Could i mix values from local data with values returned from database while using LINQ to SQL?
- Get all data from database for Administrator role but not for other roles, using same query
- Creating new instance of BitmapImage from ImagePath when retrieving data using EF
- Using LINQ to iterate through a database and generate a generic XML layout of schema + data
- How to update the data in database using linq
- trying to seed my database using code first migrations
- DataContext not visible when choosing data source for LinqDataSource
- How to reinsert data from one table onto itself using LINQ in code migration?
- I am using linq statement to update data in database
- Creating a method that queries a database using linq
- 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#
- Moving an entire slice of data to another database using LINQ
- MongoDB C# - LINQ Contains against a string array throws ArgumentException
- How to add OrderBy clause in multi-table LINQ query?
- How to sort a list after AddRange?
- Linq To Sql - Update not being persisted
- Why does Linq need a setter for a 'read-only' object property?
- Linq to XML: Bind child nodes to DataList
- Ignore time portion of DateTime in linq query
- Linq Custom sorting in ORDER BY and rest of result order by asc
- LINQ XML query by attribute and nested element
- How to get a Child Nodes Attribute
- Finding next 30 days from today
- Why am I not able to insert a value to a StringBuilder inside a LINQ Select() query
- How to find duplicates in a List<T> quickly, and update the original collection
- How do you remove trailing objects from a list with linq?
- How can I filter a list using generics and Linq extension methods?
- Linq Help please.. Direct casting to Object instead of Var
- row_number() over partition in linq
- LINQ-to-SQL select filter
- Linq Query modification to include a value in a related table
- Linq to NHibernate : is it mature?