Search code examples
c#sqldatabaseoledb

C# OleDb INSERT INTO overflow exception


My query looks like this:

INSERT INTO tblFiles (filename,downloadname,description,length,parts,checksum) 
VALUES ('IMG_0228.JPG','file1','description1'
        ,2694310,1925,26931139928208758813621215525179134210220)

I am using an access database and my table looks like this:

This is the exception I get:

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll Additional information: Overflow

I do not understand what is causing this.


Solution

  • The problem is with column datatype.

    You tried to insert 26931139928208758813621215525179134210220 into number column which obviously generate overflow error.

    You should change datatype of checksum column to string/binary.