error '80020009' - No reason for it that I can find.

I am getting the following error

error '80020009'
Exception occurred.
/apps/prototypect/shipper_view.asp, line 319


And nothing I have found here on EE or on google has helped. I'm getting frustrated. Can someone point out what I'm apparently missing here?

Code is below, line 319 preceded with 5 *'s (*****)


<%
Dim varShip, varFileName
varShip = qShipper("ShipVia")
If varShip = "Hand Deliver" Then
*****   If qHD("FName") <> "" Then
     varFileName = replace(qHD("FName"), " ", "%20")
     response.Write("<a href=UploadsSHP/"&varFileName&" target=_blank>Hand Deliver</a>")
   Else
     response.Write("Hand Deliver")
   End If
Else
   response.Write(qShipper("ShipVia"))
End If
%>
MustangzAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
SvenConnect With a Mentor Tech Lead Web-DevelopmentCommented:
Try the following SQL statement:

"SELECT SHID, isNull(FName,'') FROM dbo.tblHandDeliver WHERE SHID = " & Replace(qHD__MMColParam, "'", "''") & ""

With the isNull sql-function you will get no null values in recordset but empty strings "" and your origin if statement should work!

Also you should check if recordset is empty before accessing any value:

if not (qHD.BOF and qHD.EOF) then
  'do the work
else
  'recordset is empty
end if
0
 
BrianGEFF719Commented:
Try this:



<%
Dim varShip, varFileName
varShip = qShipper("ShipVia")
If varShip = "Hand Deliver" Then
  If Not qHD("FName") = "" Then
     varFileName = replace(qHD("FName"), " ", "%20")
     response.Write("<a href=UploadsSHP/"&varFileName&" target=_blank>Hand Deliver</a>")
   Else
     response.Write("Hand Deliver")
   End If
Else
   response.Write(qShipper("ShipVia"))
End If
%>


good luck
-brian
0
 
BrianGEFF719Commented:
or even possibly:


<%
Dim varShip, varFileName
varShip = qShipper("ShipVia")
If varShip = "Hand Deliver" Then
  If len(qHD("FName")) > 0 Then
     varFileName = replace(qHD("FName"), " ", "%20")
     response.Write("<a href=UploadsSHP/"&varFileName&" target=_blank>Hand Deliver</a>")
   Else
     response.Write("Hand Deliver")
   End If
Else
   response.Write(qShipper("ShipVia"))
End If
%>

-brian
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
SvenTech Lead Web-DevelopmentCommented:
What is qHD("FName") ? It seems to be a recordset. Please provide the code above these lines also, especially the lines where qHD("FName") or the qHD object is referenced to!
0
 
BrianGEFF719Commented:
The function shouldnt matter should it? Because if the function its self was causing the problem it would error on the function. Or the function would be returning Null as the string, either way, its erroring on the If line.


-Brian
0
 
TheKenmanCommented:
Hi Mustangz,

I would try:
   
    If Not qHD("FName") = "" Then

Could also try:

    If isNull(qHD("FName")) Then

..or:

    If isEmpty(qHD("FName")) Then
0
 
MustangzAuthor Commented:
Brian:
None of those seemed to work, kept getting the same error.

TheKenman:
Your last two caused my page to load without error, but gave me backwards results, as I want to know if qHD("FName") is NOT NULL. So I reversed some of my code as shown below, and then get the same error but now several lines below (marked with 5 *'s)

<%
Dim varShip, varFileName
varShip = qShipper("ShipVia")
If varShip = "Hand Deliver" Then
   If isEmpty(qHD("FName")) Then
   response.Write("Hand Deliver")
   Else
*****   varFileName = replace(qHD("FName"), " ", "%20")
   response.Write("<a href=UploadsSHP/"&varFileName&" target=_blank>Hand Deliver</a>")
   End If
Else
   response.Write(qShipper("ShipVia"))
End If
%>


DarthSonic:
Below is my SELECT where I am getting qHD("FName") from. Am I doing anything strange here? Yes, I'm using dreamweaver, as I'm a bit of a noob with ASP. The FName field is a varCHAR 50, and SHID is an int 4 on a Microsoft SQL 2000 database.

Set qHD = Server.CreateObject("ADODB.Recordset")
qHD.ActiveConnection = MM_connPrototype_STRING
qHD.Source = "SELECT SHID, FName FROM dbo.tblHandDeliver WHERE SHID = " & Replace(qHD__MMColParam, "'", "''") & ""
qHD.CursorType = 0
qHD.CursorLocation = 2
qHD.LockType = 1
qHD.Open()
0
 
TheKenmanCommented:
Try:

<%
Dim varShip, varFileName
varShip = qShipper("ShipVia")
If varShip = "Hand Deliver" Then
  If Not isEmpty(qHD("FName")) Then
     varFileName = replace(qHD("FName"), " ", "%20")
     response.Write("<a href=UploadsSHP/"&varFileName&" target=_blank>Hand Deliver</a>")
   Else
     response.Write("Hand Deliver")
   End If
Else
   response.Write(qShipper("ShipVia"))
End If
%>
0
 
TheKenmanCommented:
This should do the same for you though:

<%
Dim varShip, varFileName
varShip = qShipper("ShipVia")
varName = qHD("FName")
If varShip = "Hand Deliver" Then
   If Not varName = "" Then
     varFileName = Server.URLEncode(varName)
     'uncomment next line if the above fails
     'varFileName = Server.URLPathEncode(varName)
     response.Write("<a href=""UploadsSHP/"&varFileName&""" target=""_blank"">Hand Deliver</a>")
   Else
     response.Write("Hand Deliver")
   End If
Else
   response.Write(qShipper("ShipVia"))
End If
%>
0
 
BrianGEFF719Commented:
TheKenman: please review previous posts, your above code is exactly identical to my code.


-Brian
0
 
SvenTech Lead Web-DevelopmentCommented:
@TheKenman: If qHD is not a recordset or empty he will get an error!
0
 
BrianGEFF719Commented:
The only thing you changed was you moved it to a complete useless variable called "varName".


-Brian
0
 
BrianGEFF719Commented:
Try this, I think it will work.

<%
Dim varShip, varFileName
varShip = qShipper("ShipVia")
If varShip = "Hand Deliver" Then
  If isEmpty(qHD("FName")) Then
   response.Write("Hand Deliver")
  Else
  varFileName = replace(cstr(qHD("FName")), " ", "%20")
  response.Write("<a href=UploadsSHP/"&varFileName&" target=_blank>Hand Deliver</a>")
  End If
Else
  response.Write(qShipper("ShipVia"))
End If
%>


-Brian
0
 
TheKenmanCommented:
Brian,

I believe you need to go back to grammar school and learn how to read. My code is in no way "exactly identical" (redundant?) to yours!!!

Please read the comments fully before getting so critical.
0
 
BrianGEFF719Commented:
I was refering to your first post, I posted before i saw your second post.


0
 
TheKenmanCommented:
Now you're just making stuff up.

My first post didn't use varName. My second post didn't use varName. My THIRD post used varName and Server.URLEncode, and was completely different from any of yours.

Thanks for your concern though.
0
 
SvenTech Lead Web-DevelopmentCommented:
Boys! Please! We want to help Mustangz. Your personal conflict is not part of this discussion!

@Mustangz: Have you allready tried my solution? However we should not avoid the error by error handling the variable, but we should look for the source of the problem. I think it's an empty recordset or a null field!
0
 
BrianGEFF719Commented:
Why dont you try:

varFileName = CStr(qHD("FName"))  'conver to string
if varFileName <> "" then
 'not empty
else
 'empty
end if
0
 
MustangzAuthor Commented:
I appreciate everyone's input and suggestions. I went down the line trying all suggestions in the order in which they were provided, and DarthSonic is the one that fixed me.

Thanks again to everyone, I do appreciate the quick responses.
0
 
TheKenmanCommented:
Yes, sorry, but I felt Brian was trying to discredit my posts, and so I feel I must stick up for my responses. I did not start it.

Glad you got it working Mustangz!
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.