VBScript runtime (0x800A000D) & Server.URLEncode error!

hai, i have a bunck of data which is imported into access table. some of the field of the existing data is empty. when i try to the data from a page to another one by using 'Server.URLEncode' but it gives error.

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'Server.URLEncode'
/aaa/bbb/ccc/ccc.asp, line 148


line 148
myfile = "ddd.asp?mode=" & Server.URLEncode("update") & "&sID=" & Server.URLEncode(sID) & "&sName=" & Server.URLEncode(sName) & "&sLength=" & Server.URLEncode(sLength) & "&sPrdId=" & Server.URLEncode(sPrdId) & "&sL=" & Server.URLEncode(sL) & "&sC=" & Server.URLEncode(sC)

response.redirect(myfile)          

In the table(imported from excel) the fields: sL  and sC is an empty field. both allow zero length data.
somehow, when i insert a new record(not imported data) with empty field for sL and sC. it dun give error as above although the sL and SC is empty.

does anyone has any idea? ur help will much appreciated! thanks a lot!
khongkhamAsked:
Who is Participating?
 
Michel SakrConnect With a Mentor Commented:
Possible when a data is null it will throw the error but if the data is empty it won't.. Null is not the same as empty.. null is undefined.. so my advice either always store a value (by defining a default value in the db) where you know if this value shows up then no data is entered or check the recordset field value before using it using the function ISNULL()
0
 
drittichCommented:
Server.URLEncode( takes a string as a parameter, so if sID, sPrdId, etc. are numbers, that would cause a problem.
0
 
hongjunCommented:
drittich is correct. If it is an integer, then you should not need to have that.

hongjun
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
khongkhamAuthor Commented:
nope, sC and sL are both text field. would it b'coz after imported the existing data from excel to access that the empty fields (sC and sL) has contained some special character that can't be visiblly seen??? maybe, something like \n??? but, i used response.write. to display the data for sC and sL nothing is shown!
0
 
hongjunCommented:
Try doing a response.write on those variables.

hongjun
0
 
khongkhamAuthor Commented:
these are the result:

sName:MANASAEY MANASAEY
sLength:5.31
sC:
sL:s
sPrdId:22

no data contained for sC (this is an existing record, imported from excel)
0
 
drittichCommented:
is sPrdId a string or number?
0
 
khongkhamAuthor Commented:
sPrdId is a number
0
 
khongkhamAuthor Commented:
hai, i had tested... change sPrdId to a text field but it still give the same error!!
0
 
hongjunCommented:
Try this
Server.URLEncode(CStr(sPrdId))

hongjun
0
 
weesiongCommented:
Silvers5 is correct :)

Regards,
Wee Siong
0
 
khongkhamAuthor Commented:
hai, if i want to se the default valu in access table how to set it?
0
 
khongkhamAuthor Commented:
sorry, i actuall want to find out how to use the ISNYLL() in the recordset. could u give me a simple example.


thanks!
0
 
hongjunCommented:
There is a default property for all fields. Make sure that you are in design mode. Click the field and then change the default property. By default, it is empty.

hongjun
0
 
Michel SakrCommented:
If ISNULL(rs("fieldName")) then
'field is null event error will show up here
else
'do as usual
end if


isnull returns a boolean value (true/false)
0
 
khongkhamAuthor Commented:
thanks, it really solve my problem!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.