Shane_OConnor
asked on
Callin a dll problem (again!) Exception Occured...
error '80020009'
Exception occurred.
/MPLive/marketplace/Email/ MailDetail s.asp, line 37
What is this damn error?? The line in question is:
Set rsdetails = mail.GetMailDetails(Reques t.QueryStr ing("MailI D"), session("userid"))
Cant get rid of it and I cant find anything on it on the net...
Exception occurred.
/MPLive/marketplace/Email/
What is this damn error?? The line in question is:
Set rsdetails = mail.GetMailDetails(Reques
Cant get rid of it and I cant find anything on it on the net...
what happens if you do this (just for testing)
Dim mailID,userID
mailID = Request.QueryString("MailI D")
userID = session("userid")
response.write mailID & " " & userID
Dim mailID,userID
mailID = Request.QueryString("MailI
userID = session("userid")
response.write mailID & " " & userID
would you look at that! two test scripts written at exactly the same time,what are the odds of that
ASKER
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...
you might need to cint your values if they are numerical:
Set rsdetails = mail.GetMailDetails(cint(R equest.Que ryString(" MailID")), cint(session("userid")))
Set rsdetails = mail.GetMailDetails(cint(R
ASKER
They both are, but the dll function called is headed like this...
Function GetMailDetails(mailid, userid)
Function GetMailDetails(mailid, userid)
>would you look at that! two test scripts written at exactly the same time,what are the odds of that
first come basis
first come basis
also the request might be returning nothing and you didn't set a trap for that.. can you post the dll function code..
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
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
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Incidentally the code in the ASP page calling it is here:
<%session("curpage") = "Email/MailDetails.asp?Mai lID=" & request.querystring("MailI D")%>
<!--#INCLUDE FILE="../includes/sessionc heck.inc"- ->
<%
Dim Mail
Set cn1 = server.createobject("adodb .connectio n")
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("MailI D"), 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("metal market.use r")
Set mail = server.CreateObject("metal market.mai l")
Set trade = server.CreateObject("metal market.tra de")
'The line below seems to be where the error is reported....
Set rsdetails = mail.GetMailDetails(Reques t.QueryStr ing("MailI D"), session("userid"))
If int(session("userid")) = int(rsdetails("receiver")) Then
mail.readmail(Request.Quer yString("M ailID"))
End If
%>
<!--#INCLUDE FILE="../includes/function s.inc"-->
<%session("curpage") = "Email/MailDetails.asp?Mai
<!--#INCLUDE FILE="../includes/sessionc
<%
Dim Mail
Set cn1 = server.createobject("adodb
Set rs1 = server.createobject("adodb
Set rsdetails = server.createobject("adodb
cn1.open "metalpages_phase2", "sa", ""
rs1.open "select * from tblemails where emailid = " & request.querystring("MailI
'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"
valid = True
End If
If rs1("sender") = int(session("registration"
valid = True
End If
If valid = False Then
response.redirect "../login_error.asp"
End If
End If
%>
<html>
<head>
<%
Set auser = server.CreateObject("metal
Set mail = server.CreateObject("metal
Set trade = server.CreateObject("metal
'The line below seems to be where the error is reported....
Set rsdetails = mail.GetMailDetails(Reques
If int(session("userid")) = int(rsdetails("receiver"))
mail.readmail(Request.Quer
End If
%>
<!--#INCLUDE FILE="../includes/function
Try changing
Function GetMailDetails(mailid, userid)
to
Public Function GetMailDetails(ByVal mailid As String, ByVal userid As String) As ADODB.Recordset
Marko
Function GetMailDetails(mailid, userid)
to
Public Function GetMailDetails(ByVal mailid As String, ByVal userid As String) As ADODB.Recordset
Marko
ASKER
marko, that didnt do a whole lot... Any other ideas guys???
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 ?
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 ?
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.
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.
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
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
ASKER
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!
Sometimes a single line of comment shouldn't be ignored
;o)
rgrds
;o)
rgrds
ASKER
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...
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,UI
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