Hi guys,
i have this function to save the data in an MS-Database. The function is accessed from the web. In the case where the fields in the table are already empty (NULL), then i get this error:
Microsoft VBScript runtime error ‘800a000d’
Type mismatch: ‘ccur’
/databaseadmin.asp, line 669
here is the code:
Sub SaveRec
‘Save the record to the table’
OpenCon
ChooseSQL “Select * from ” & sTable & ” where(ID=” & sID & “)”
if sID = 0 then
rs.addnew
else
rs.movefirst
end if
For i = 0 to rs.fields.count – 1
If CBool(rs.fields(i).Attributes And adFldUpdatable) then
‘set the field value’
select case rs.fields(i).type
case adBigInt
rs.fields(i).value = csng(Request.Form(rs.fields(i).name))
case adBoolean
if trim(Request.Form(rs.fields(i).name) = “”) then
rs.fields(i).value = False
else
rs.fields(i).value = True
end if
case adCurrency
rs.fields(i).value = ccur(Request.Form(rs.fields(i).name))
case adDate,adDBDate,adDBTime,adDBTimeStamp
rs.fields(i).value = cdate(Request.Form(rs.fields(i).name))
case adDecimal
rs.fields(i).value = cdec(Request.Form(rs.fields(i).name))
case adDouble
rs.fields(i).value = cdbl(Request.Form(rs.fields(i).name))
case adInteger
rs.fields(i).value = cint(Request.Form(rs.fields(i).name))
case adSingle
rs.fields(i).value = csng(Request.Form(rs.fields(i).name))
case else
rs.fields(i).value = Request.Form(rs.fields(i).name)
end select
end if
next
rs.UpdateBatch adAffectAll
CloseCon
%>
Your record has been saved.<BR>
<%
WriteLink “?action=listrec&table=” & sTable,”Click here to continue.”,”<BR>”
How can i fix this? The easiest solution would be in case the field is already empty, then go to the next entry of the table
any advice guys?
thanks in advance