Solved

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

Posted on 2001-06-25
20
220 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
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.

707 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

20 Experts available now in Live!

Get 1:1 Help Now