Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6856055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:50:11+00:00 2026-05-27T01:50:11+00:00

I’m developing (or trying to develop) a project in C# which stores data in

  • 0

I’m developing (or trying to develop) a project in C# which stores data in an SQLite database. I’d like to use Linq for object-relational mapping. According to what I’ve read it’s possible to use it with SQLite if you download System.Data.SQLite and dblinq.

And although it mostly works for reading data from the DB, I get an SQL syntax error when trying to insert anything. I’ve checked in logs that Linq is attempting to execute such a query:

{INSERT INTO [sometable]([columnone], [columntwo])
VALUES (@p0, @p1)

SELECT CONVERT(Int,SCOPE_IDENTITY()) AS [value]
-- @p0: Input String (Size = 4000; Prec = 0; Scale = 0) [foo]
-- @p1: Input String (Size = 4000; Prec = 0; Scale = 0) [bar]
-- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build: 4.0.30319.1
}

It seems to be an SQL query for MS Server, not SQLite. The upsetting part is this SqlProvider(Sql2008). Shouldn’t it be replaced by something provided by dblinq?

My database class looks like this:

[Database]
class MyDatabase : DataContext
{
    public LibraryDatabase()
        : base(new SQLiteConnection(
                    "DbLinqProvider=Sqlite; " +
                    "Data Source=database.s3db;"))
    {
    }

    public Table<SomeObject> SomeTable;
}

The connection string is taken from the dblinq wiki.

Why doesn’t it work? Is it because I’m using .NET 4.0? Has anyone successfully used such a combination? Is there another way to replace the Linq Provider?

EDIT: The table mapping: (though I doubt the error is here, as reading the table (using a foreach loop) seems to work)

[Table(Name="sometable")]
class Element
{
    [Column(Name = "id", IsPrimaryKey = true, IsDbGenerated=true)]
    public int Id { get; set; }

    [Column(Name="columnone")]
    public string PropertyOne {get; set;}

    [Column(Name="columntwo")]
    public string PropertyTwo {get; set;}
}

All the relations between tables were commented out for testing (doesn’t help).
An element is then inserted with the following code:

myDatabase.SomeTable.InsertOnSubmit(element);
myDatabase.SubmitChanges();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:50:11+00:00Added an answer on May 27, 2026 at 1:50 am

    I’m guessing you’re using Entity Framework for the ORM?

    In your MyDatabase class, you are inheriting from DataContext. This Represents the main entry point for the LINQ to SQL framework. This works well for SQL Server. Not so well with SQLite.

    Instead, inherit from the ObjecContext class. This provides facilities for querying and working with entity data as objects. You’ll probably have to modify the code that you use for your queries but it should be pretty straight forward.

    Do some searching on Entity Framework and ObjectContext, there are a bunch of good examples.

    Patrick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.