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

  • Home
  • SEARCH
  • 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 332251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:51:00+00:00 2026-05-12T09:51:00+00:00

I meet a problem about: Object of type ‘System.Int64’ cannot be converted to type

  • 0

I meet a problem about: Object of type ‘System.Int64’ cannot be converted to type ‘System.Int32’ when run the SubSonic.Examples.SimpleRepo project base on SQLite provider.

I fond that the data type for table Categories’s column CategoryID is ‘integer‘, and the ‘integer’ in SQLite will be return as Int64, in the same time the CategoryID’s data type in the Class Category is int, the above error is happened.

I checked the SubSonic’s source code: \SubSonic.Core\SQLGeneration\Schema\SQLiteSchema.cs and find the following codes:

else if (column.IsPrimaryKey && column.DataType == DbType.Int32
    || column.IsPrimaryKey && column.DataType == DbType.Int16
    || column.IsPrimaryKey && column.DataType == DbType.Int64
    )
    sb.Append(" integer ");

Who can tell me the purpose for these codes?
How to solve the data type convert error?

  • 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-12T09:51:00+00:00Added an answer on May 12, 2026 at 9:51 am

    Funny I just read the sqlite3 documentation on this about an hour ago. So you’re in luck 🙂

    See the doc yourself (Scroll to the bottom, 64-bit ROWIDs section).

    Here’s the excerpt:

    To minimize storage space, the 64-bit rowid is stored as a variable
    length integer. Rowids between 0 and 127 use only a single byte.
    Rowids between 0 and 16383 use just 2 bytes. Up to 2097152 uses three
    bytes. And so forth. Negative rowids are allowed but they always use
    nine bytes of storage and so their use is discouraged. When rowids are
    generated automatically by SQLite, they will always be non-negative.

    3rd party edit

    I was suprised that the Id-column despite being created as an int column was mapped to long as well

    CREATE TABLE "Example" (
        "Id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
        "Foo" TEXT NULL,
        "SomeDate" DATETIME NULL
    )  
    

    the explanation is also in the 64-bit ROWID section

    Every row of a table has a unique rowid. If the table defines a column
    with the type "INTEGER PRIMARY KEY" then that column becomes an alias
    for the rowid. But with or without an INTEGER PRIMARY KEY column,
    every row still has a rowid.

    In SQLite version 3.0, the rowid is a 64-bit signed integer.

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

Sidebar

Ask A Question

Stats

  • Questions 211k
  • Answers 211k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The priority setting is different than what you're thinking. The… May 12, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer I believe that this code results in double dereferencing when… May 12, 2026 at 10:05 pm
  • Editorial Team
    Editorial Team added an answer ASP.Net AJAX may also be worth reading as there are… May 12, 2026 at 10:05 pm

Related Questions

I meet a problem about: Object of type 'System.Int64' cannot be converted to type
What is the proper way to implement assignment by value for a reference type?
Here is a hum-dinger of a problem that I have not found an answer
A common problem in any language is to assert that parameters sent in to
I am trying to setup a repository of reusable code. I was thinking about

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.