Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Provider error '80020005' Type Mismatch error

Status
Not open for further replies.

gchaves

Programmer
Oct 27, 2003
105
US
OK. I'm sure someone has seen this error message before and knows what to do about it. If so, I would sincerely appreciate your help before I pull the rest of my hair out!

Here is the error message I am receiving:

Code:
Provider error '80020005' 

Type mismatch. 

/admin/includes/add_class_calendar.asp, line 409

Line 409 is:
Code:
objRSClassCalenderAdd("ID_start") = Request.Form("ID_start")

Line 409 is embedded within an update statement to append a new record to the end of an existing table (I would much rather use an INSERT statement, but have been unsuccessful as I have a textarea set as a datatype=memo...my INSERT statement refuses to work as a result. I will post that issue later).

Code:
			'create recordset object
			Dim sqlClassCalenderAdd
			Dim objRSClassCalenderAdd
			Set objRSClassCalenderAdd = Server.CreateObject("ADODB.Recordset")

			'create SQL statement to get all fields for all records in the database and order the records by ID number
			sqlClassCalenderAdd = "SELECT class_calendar.ID_day, class_calendar.ID_month, class_calendar.ID_dayofmonth, class_calendar.ID_year, class_calendar.title, class_calendar.start_time, class_calendar.ID_start, class_calendar.end_time, class_calendar.ID_end, class_calendar.event_desc, class_calendar.event_loc, class_calendar.event_city, class_calendar.post_date, class_calendar.expire_date FROM class_calendar;"
			'open the recordset
			objRSClassCalenderAdd.Open sqlClassCalenderAdd, objConn, 2, 3
			
			'move to the last record in the recordset
			objRSClassCalenderAdd.MoveLast

			'add the next entry, obtaining the info from the form (Greg code)
			objRSClassCalenderAdd.AddNew

			'objRSClassCalenderAdd("ID_Event") = Clng(Request.Form("ID_Event"))
			objRSClassCalenderAdd("ID_day") = Request.Form("ID_day")
			objRSClassCalenderAdd("ID_month") = Request.Form("ID_month")
			objRSClassCalenderAdd("ID_dayofmonth") = Request.Form("ID_dayofmonth")
			objRSClassCalenderAdd("ID_year") = Request.Form("ID_year")
			objRSClassCalenderAdd("title") = Request.Form("title")
			objRSClassCalenderAdd("start_time") = Request.Form("start_time")
			objRSClassCalenderAdd("ID_start") = Request.Form("ID_start")
			objRSClassCalenderAdd("end_time") = Request.Form("end_time")
			objRSClassCalenderAdd("ID_end") = Request.Form("ID_end")
			objRSClassCalenderAdd("event_desc") = Request.Form("event_desc")
			objRSClassCalenderAdd("event_loc") = Request.Form("event_loc")
			objRSClassCalenderAdd("event_city") = Request.Form("event_city")
			objRSClassCalenderAdd("post_date") = Request.Form("post_date")
			objRSClassCalenderAdd("expire_date") = Request.Form("expire_date")

			'update the database now
			objRSClassCalenderAdd.Update

Here is where the information for line 409 is set:
Code:
'-------------------------------------------------------------
					'dynamic dropdown for Position list starts here
					'create recordset object
					Dim sqlCalendarStartAMPMAdd
					Dim objRSCalendarStartAMPMAdd
					Set objRSCalendarStartAMPMAdd = Server.CreateObject("ADODB.Recordset")

					'create SQL statement to get all fields for all records in the state table of the database 
					'and order the records by ID number

						sqlCalendarStartAMPMAdd = "SELECT * FROM calendar_start_ampm ORDER BY ID_start;"

						'open the recordset
						objRSCalendarStartAMPMAdd.Open sqlCalendarStartAMPMAdd, objConn, 2, 3

						objRSCalendarStartAMPMAdd.MoveFirst
	
						'Response.Write "<input type=""hidden"" name=""ID_State"" value="""">"
						Response.Write "<td align=""left""><b>AM/PM:</b></td>"
						Response.Write "<td align=""left"">"
					
						'start select tag here
						Response.Write "<select name=""ID_start"" size=""1"">" & VbCrLf
						Response.Write "<option value="""" SELECTED>---" & VbCrLf

						Do While Not objRSCalendarStartAMPMAdd.EOF 
			
						Response.Write "<option value=" & objRSCalendarStartAMPMAdd("ID_start") & ">" & objRSCalendarStartAMPMAdd("start_ampm") & "</option>" & VbCrLf
					
							objRSCalendarStartAMPMAdd.MoveNext
			
						Loop

					Response.Write "</select></td></tr>" & VbCrLf
				
					'end dynamic list for lri positions

'-------------------------------------------------------------

The datatype for ID_start is set to Integer and the field is a foreign key for a separate table that is linked to this table. I have tried setting the field to cInt with no luck.

Why am I getting this error and how do I fix it?

Any help would be sincerely appreciated!

Thanks,
GC
 
For testing purposes, what happens if you hardcode a numeric value:
[tt]objRSClassCalenderAdd("ID_start") = 12345[/tt]

You might add something like this for debugging:
Code:
If Not IsNumeric(Request.Form("ID_start")) Then
  response.write "<br>Bad value of ID_start<br>" & vbCrLF
  response.end
End if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top