Callin a dll problem (again!) Exception Occured...

error '80020009'
Exception occurred.

/MPLive/marketplace/Email/MailDetails.asp, line 37


What is this damn error?? The line in question is:

Set rsdetails = mail.GetMailDetails(Request.QueryString("MailID"), session("userid"))


Cant get rid of it and I cant find anything on it on the net...
LVL 1
Shane_OConnorAsked:
Who is Participating?
 
Michel SakrConnect With a Mentor Commented:
check this if you have large text or blob fields..

http://support.microsoft.com/support/kb/articles/Q175/2/39.asp
0
 
_marko_Commented:
Try this to find out that both variables contain values and that the mail object has been created:



Dim MID, UID
MID = Request("MailID") & "" ' Makes them string-compatible
UID = Session("userid") & ""

If IsObject ( mail ) Then
    If MID <> "" And UID <> "" Then
        Set rsdetails = mail.GetMailDetails(MID,UID)
    Else
        If MID <> "" Then
            Response.Write "Session(""userid"") is empty"
        Else
            Response.Write "Request(""MailID"") is empty"
        End If
    End If
Else
    Response.Write "mail object has not been created"
End If



Marko
0
 
MattCCommented:
what happens if you do this (just for testing)

Dim mailID,userID

mailID = Request.QueryString("MailID")
userID = session("userid")

response.write mailID & " " & userID






0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
MattCCommented:
would you look at that! two test scripts written at exactly the same time,what are the odds of that
0
 
Shane_OConnorAuthor Commented:
I know for sure that values are being passed to the dll, and the query in the dll is sound, I tested it in Query Analyser, I was running the test site in debug mode on VB, ie stepping through each call the site made to the dll and it doesnt seem to even make the call to the Dll.... strange... error seems to be in the line itself or before it...
0
 
Michel SakrCommented:
you might need to cint your values if they are numerical:

Set rsdetails = mail.GetMailDetails(cint(Request.QueryString("MailID")), cint(session("userid")))
0
 
Shane_OConnorAuthor Commented:
They both are, but the dll function called is headed like this...
Function GetMailDetails(mailid, userid)
0
 
Michel SakrCommented:
>would you look at that! two test scripts written at exactly the same time,what are the odds of that


first come basis
0
 
Michel SakrCommented:
also the request might be returning nothing and you didn't set a trap for that.. can you post the dll function code..
0
 
John844Commented:
Shane

if you are running your dll in MTS, you can try removing the dll from the package, copy it over to the server again and add it to the package again.  I have seen this same error many times and this usually fixes it for me.

Happy hunting
John
0
 
Shane_OConnorAuthor Commented:
John, tried many a time!! No luck, silvers here is the function :
Function GetMailDetails(mailid, userid)

Dim rs As ADODB.Recordset
Dim strsql As String
OpenDB
Set rs = New ADODB.Recordset

strsql = "SELECT tblEmails.*, Companies.CompanyName, Metals.MetDescription, * FROM Companies INNER JOIN (Metals INNER JOIN (tblEmails INNER JOIN tblProposals ON tblEmails.proposalid = tblProposals.proposalid) ON Metals.MetalID = tblProposals.MetalID) ON Companies.UserID = tblEmails.sender WHERE (((tblEmails.emailid)=" & mailid & "))"
'rs.CursorLocation = adUseServer
rs.Open strsql, DB, 3, 2

Set GetMailDetails = rs
End Function


Ive tested the query and it is working fine, also, it is not possible to call this function unless the email exists in the database
0
 
Shane_OConnorAuthor Commented:
Incidentally the code in the ASP page calling it is here:
<%session("curpage") = "Email/MailDetails.asp?MailID=" & request.querystring("MailID")%>
<!--#INCLUDE FILE="../includes/sessioncheck.inc"-->
<%
Dim Mail
Set cn1 = server.createobject("adodb.connection")
Set rs1 = server.createobject("adodb.recordset")
Set rsdetails = server.createobject("adodb.recordset")

cn1.open "metalpages_phase2", "sa", ""
rs1.open "select * from tblemails where emailid = " & request.querystring("MailID"), cn1, 3, 2
'response.write session("registration") & ", "
'response.write rs1("receiver") & ", "
'response.write rs1("sender")
'response.end
If rs1.eof Then
     response.redirect "../login_error.asp"
Else
     valid = False
     If rs1("receiver") = int(session("registration")) Then
          valid = True
     End If
     If rs1("sender") = int(session("registration")) Then
          valid = True
     End If
     If valid = False Then
          response.redirect "../login_error.asp"
     End If
End If
%>
<html>
<head>
<%
Set auser = server.CreateObject("metalmarket.user")
Set mail = server.CreateObject("metalmarket.mail")
Set trade = server.CreateObject("metalmarket.trade")
'The line below seems to be where the error is reported....
Set rsdetails = mail.GetMailDetails(Request.QueryString("MailID"), session("userid"))
If int(session("userid")) = int(rsdetails("receiver")) Then
     mail.readmail(Request.QueryString("MailID"))
End If
%>
<!--#INCLUDE FILE="../includes/functions.inc"-->
0
 
_marko_Commented:
Try changing

Function GetMailDetails(mailid, userid)

to

Public Function GetMailDetails(ByVal mailid As String, ByVal userid As String) As ADODB.Recordset


Marko
0
 
Shane_OConnorAuthor Commented:
marko, that didnt do a whole lot... Any other ideas guys???

0
 
enkay022798Commented:
Try this ...

strsql = "SELECT tblEmails.*, Companies.CompanyName, Metals.MetDescription, * FROM Companies INNER JOIN
(Metals INNER JOIN (tblEmails INNER JOIN tblProposals ON tblEmails.proposalid = tblProposals.proposalid)
ON Metals.MetalID = tblProposals.MetalID) ON Companies.UserID = tblEmails.sender WHERE (((tblEmails.emailid)="
& CStr(mailid) & "))"

convert the mailid to a string when you construct your sql query.

Are you running the dll and the asp script on the same machine or is it a DCOM environment ?
0
 
robbertCommented:
My 0.02$:

1. The problem could also be in the OpenDB function.

2. Raise errors, like:

Function x
    On Error Goto ErrHandler
    ' do stuff
    Exit Function
ErrHandler:
    Err.Raise Err.Number, Err.Source, Err.Description
End Function

3. (The only true way.) Use InterDev to debug:
In the VB IDE, run the DLL by pressing F5. Before, set a breakpoint. In InterDev, set the start page, and press F5. When the breakpoint in VB is reached, use F8 to step through.
0
 
preinskoCommented:
You might want to consider putting some error trapping into your dll because this inane error can be caused when an empty recordset is returned.  This doesn't mean the sql query is wrong it just means something is wrong.  

Maybe the connection is never really made.  I assume "openDB" is a call to a subroutine but there is no way to know if the subroutine succeeded because a subroutine returns no value.  If you change the sub to a function that returns success or failure that may help. so then when you call the function you would say
intRetVal = openDB()
if(intRetVal=-1) then
   raise error.
else
   continue
end if


0
 
Shane_OConnorAuthor Commented:
I solved the prob my self, thanks for the help everyone. It was the order in which the data was coming out of the database, ie I put the textfields first and problem solved. ****ing SQL. Silvers sent a page about this I think, so I better award him the points... cheers everyone!
0
 
Michel SakrCommented:
Sometimes a single line of comment shouldn't be ignored

;o)

rgrds
0
 
Shane_OConnorAuthor Commented:
The error it seems also came about because global.asa got overwritten somehow and was looking at a different database, but I code all my connections and specify the datasae everywhere except this one place hence the probs... but thanks for everyones help anyways...
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.