Arithmetic Overflow etc...Error for datetime in gridview
-
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!