I am using a Gridview which displays a calendar. when i click on the calendar, the date should be inserted in my database. but instead i get this error.
System.Data.SqlTypes.SqlTypeException: SqlDateTime
overflow. Must be between 1/1/1753 12:00:00 AM and
12/31/9999 11:59:59 PM
I have an insert stored procedure :
Expand|Select|Wrap|Line Numbers
- SELECT @alloc_ID = INV_ID, @pac_code = PAC_CODE, @ALCTN_ST_Date = ALCTN_ST_DATE,
- @ALCTN_ED_Date = ALCTN_ED_DATE,@ALCTN_MCHNE_Name = ALCTN_MCHNE_NAME, @ALCTN_Date = ALCTN_DATE,
- @INV_Status = INV_STATUS, @RELEASE_Date = RELEASE_DATE,@RENEWD_Date = @selected_date, @Request_ID = REQUEST_ID, @HW_ID = HARDWARE_ID
- FROM INV_Allocation_DB
- /* Insert statement for inserting data into INV_Allocation_DB */
- INSERT INTO INV_Allocation_DB(INV_ID, PAC_CODE, ALCTN_ST_DATE, ALCTN_ED_DATE,
- ALCTN_MCHNE_NAME, ALCTN_DATE, INV_STATUS, RELEASE_DATE, RENEWD_DATE,REQUEST_ID, HARDWARE_ID)
- VALUES (@inv_ID,@pac_code,@ALCTN_ST_Date,@ALCTN_ED_Date,@ALCTN_MCHNE_Name,@ALCTN_Date, 'INRENEW',@RELEASE_Date,@RENEWD_DATE,@Request_ID,@HW_ID)
I am calling this in vb by using this code:
Expand|Select|Wrap|Line Numbers
- Dim selected_date As DateTime
- selected_date = CalendarRenew.SelectedDate
- TableAdapterspInsert.insert(GridViewRenew.SelectedRow.Cells(2).Text.ToString, selected_date)
the procedure gets executed when i run it in sql but i get the above mentioned error when i run it in vb. can anyone tell me how to correct this?
thanks a lot.