Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Arithmetic Overflow etc...Error for datetime in gridview

Arithmetic Overflow etc...Error for datetime in gridview

Scheduled Pinned Locked Moved ASP.NET
helptutorialannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BORN again
    wrote on last edited by
    #1

    Smiles to all, We are moving from Datagrid to gridview in one of the applications and the gridview is linked to a datasource with Select Command as below ... SELECT DriverNo, RegNo, DriverName,projectcode,Convert(datetime,startdate,103) as StartDate, Convert(Datetime,enddate,103) as EndDate, OdoReading, currentdriver FROM DriverDetails where regno=@regno and Update Command as ... UPDATE DriverDetails SET DriverName = @drivername, StartDate = @startdate, EndDate = @enddate, OdoReading = @odoreading, projectcode = @projectcode, currentdriver = @currentdriver WHERE (DriverNo = @driverno) My dates (startdate & enddate) are in the dd/mm/yyyy format(I'm in Australia) and I already have more than 500 records created with date stored in above format. The gridview populates fine but when I try to update the values I get the following error: Arithmetic overflow error converting expression to data type datetime. The statement has been terminated. I know it is the date format but don't how to fix it in the update command. if I type the date as 20/01/2006(dd/mm/yyyy) it fails but if I type the date as 01/20/2006(mm/dd/yyyy) it works. But the users want it as dd/mm/yyyy plus it is impossible to change date formats for previous records. There is no code-behind. I am doing update on UpdateCommand of my datasource so please suggest how to modify the update command to convert dates. Thanks.

    Aartee. ...HE is watching Us All!

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups