Solved

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

Posted on 2001-06-25
20
221 Views
Last Modified: 2012-06-21
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...
0
Comment
Question by:Shane_OConnor
  • 7
  • 5
  • 2
  • +5
20 Comments
 
LVL 2

Expert Comment

by:_marko_
ID: 6224222
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
 
LVL 1

Expert Comment

by:MattC
ID: 6224225
what happens if you do this (just for testing)

Dim mailID,userID

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

response.write mailID & " " & userID






0
 
LVL 1

Expert Comment

by:MattC
ID: 6224233
would you look at that! two test scripts written at exactly the same time,what are the odds of that
0
 
LVL 1

Author Comment

by:Shane_OConnor
ID: 6224244
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
 
LVL 20

Expert Comment

by:Silvers5
ID: 6224258
you might need to cint your values if they are numerical:

Set rsdetails = mail.GetMailDetails(cint(Request.QueryString("MailID")), cint(session("userid")))
0
 
LVL 1

Author Comment

by:Shane_OConnor
ID: 6224267
They both are, but the dll function called is headed like this...
Function GetMailDetails(mailid, userid)
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 6224295
>would you look at that! two test scripts written at exactly the same time,what are the odds of that


first come basis
0
 
LVL 20

Expert Comment

by:Silvers5
ID: 6224304
also the request might be returning nothing and you didn't set a trap for that.. can you post the dll function code..
0
 
LVL 7

Expert Comment

by:John844
ID: 6224309
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
 
LVL 1

Author Comment

by:Shane_OConnor
ID: 6224325
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 20

Accepted Solution

by:
Silvers5 earned 50 total points
ID: 6224343
check this if you have large text or blob fields..

http://support.microsoft.com/support/kb/articles/Q175/2/39.asp
0
 
LVL 1

Author Comment

by:Shane_OConnor
ID: 6224352
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
 
LVL 2

Expert Comment

by:_marko_
ID: 6224355
Try changing

Function GetMailDetails(mailid, userid)

to

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


Marko
0
 
LVL 1

Author Comment

by:Shane_OConnor
ID: 6224551
marko, that didnt do a whole lot... Any other ideas guys???

0
 
LVL 2

Expert Comment

by:enkay022798
ID: 6225618
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
 
LVL 15

Expert Comment

by:robbert
ID: 6226567
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
 
LVL 2

Expert Comment

by:preinsko
ID: 6230289
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
 
LVL 1

Author Comment

by:Shane_OConnor
ID: 6230493
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
 
LVL 20

Expert Comment

by:Silvers5
ID: 6230525
Sometimes a single line of comment shouldn't be ignored

;o)

rgrds
0
 
LVL 1

Author Comment

by:Shane_OConnor
ID: 6252545
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IIS POST request being ignored 4 53
Classic ASP error- Object required: 'objFolder' 6 36
Time/Date Query 11 37
Error in query expression 3 34
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now