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 347799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:18:19+00:00 2026-05-12T11:18:19+00:00

I thought this was covered elsewhere but I don’t see it now. Anyway, having

  • 0

I thought this was covered elsewhere but I don’t see it now. Anyway, having a problem with a simple v3 query. Using SQLite ADO.NET provider 1.0.65.0. My table structure looks like this:

CREATE TABLE "SamplerData" ("RowId" INT PRIMARY KEY  NOT NULL ,"SampName" VARCHAR(128),"SampPurpose" VARCHAR(2048),"ActiveState" INTEGER NOT NULL  DEFAULT 1 )

My Structs1.cs file has this in it:

        Columns.Add(new DatabaseColumn("RowId", this)
        {
                IsPrimaryKey = true,
                DataType = DbType.Int32,
                IsNullable = false,
                AutoIncrement = false,
                IsForeignKey = false
        });

        Columns.Add(new DatabaseColumn("SampName", this)
        {
                IsPrimaryKey = false,
                DataType = DbType.AnsiString,
                IsNullable = true,
                AutoIncrement = false,
                IsForeignKey = false
        });

        Columns.Add(new DatabaseColumn("SampPurpose", this)
        {
                IsPrimaryKey = false,
                DataType = DbType.AnsiString,
                IsNullable = true,
                AutoIncrement = false,
                IsForeignKey = false
        });

        Columns.Add(new DatabaseColumn("ActiveState", this)
        {
                IsPrimaryKey = false,
                DataType = DbType.Int32,
                IsNullable = false,
                AutoIncrement = false,
                IsForeignKey = false
        });

I have a query in a WPF codebehind that looks like this:

SqlQuery sqlsql = new Select()
  .From( "SamplerData" )
  .Where( "ActiveState" )
  .IsEqualTo( 1 );
List<SamplerDatum> sampAll = sqlsql .ExecuteTypedList<SamplerDatum>();

A breakpoint set to show the value of sqlsql shows this:

{SELECT * FROM `SamplerData` WHERE ActiveState = @0}

Then the code throws with:

{“Object of type ‘System.Int64’ cannot be converted to type ‘System.Int32’.”}

A “find” in Visual Studio didn’t show me where the Int64 conversion was happening. I understand that SQLite uses Int64 for identity columns, but not why/how SubSonic is handling the conversion when the Structs is making it Int32 anyway.

Help?!

Thanks..

  • 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-12T11:18:19+00:00Added an answer on May 12, 2026 at 11:18 am

    I don’t know much about SubSonic, but the ADO.NET client for sqlite uses int64 for all integer columns. Without knowing SubSonic, this is just a guess, but you may want to change the DbType.Int32 columns to DbType.Int64.

    Most likely, the query is actually executing fine, but the return values (untyped initially, in ADO.NET fashion) are being unboxed into some SubSonic data structures – structures it thinks should be 32-bit integers, based on your DbType.Int32 statement. You cant unbox a long into an int (i.e. (int)(object)(long)0 will throw an Exception) – so you need to tell SubSonic to expect 64-bit integers, since that’s what SQLite is going to give you.

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

Sidebar

Related Questions

I thought this would be fairly simple but it turns out not to work
I would have thought this one would be simple but I'm trying to change
I thought this would be fairly easy, but I'm totally baffled. I want one
I thought this would be pretty easy but I'm running into all sorts of
I thought this was a privilege issue but I logged on as admin and
I thought this question would have already existed on SO, but then I couldn't
I consistently run into this problem where I'm trying to validate user input but
Sorry if this has been covered - I've been looking for hours but I
I have seen this topic somewhat covered in posts here and here , but
So I thought I had covered my bases, but apparently I'm missing a key

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.