Author |
Topic  |
|
Cliff
Average Member
  
United States
501 Posts |
Posted - 04 August 2004 : 19:06:38
|
I had a file writtem for me when I was using an Access 2000 database and it worked great. I have now moved the site and moved the data to MS SQL. Should this same code work? I get this error:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'openrs'
/AceProject/server01/Tasksoondue.asp, line 28
This is the page:
<html>
<head>
<title></title>
</head>
<body>
<!-- 'INCLUDE FILE="Common.asp" -->
<%
Dim sCompanyID
Dim BodyText
Dim Email
Dim TaskID
Dim TaskNumber
Dim ProjectID
Dim DateNow
CompanyID = Request.QueryString("CompanyID")
DaysSoonDue = Request.QueryString("DaysSoonDue")
DateNow = month(now()) & "/" & day(now()) & "/" & year(now())
if DaysSoonDue = "" then DaysSoonDue = 1
'get users
if CompanyID <> "" then
openrs rsUser, "select user_id, email_alert from users where email_alert <> '' and company_id = " & CompanyID
else
Line 28 ---> openrs rsUser, "select user_id, email_alert from users where email_alert <> ''"
end if
while not rsUser.eof
'for each assigned or reviewer user, look for soon due tasks
sql = "select task_id, task_number, project_id, date_expected_end_task from task " & _
"where status_type_id in (select status_type_id from status_type where completed_status = 0) " & _
"and (user_doing_id = " & getvalue(rsUser,"user_id") & " or user_verify_id = " & getvalue(rsUser,"user_id") & ") " & _
"and datediff('d', '" & DateNow & "', date_expected_end_task) > 0 and datediff('d', '" & DateNow & "', date_expected_end_task) <= " & DaysSoonDue
openrs rsTask,sql
while not rsTask.eof
BodyText = ""
BodyText = BodyText & "<html>" & GetHtmlHead()
BodyText = BodyText & "<BODY bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>"
BodyText = BodyText & "<TABLE height=""100%"" cellSpacing=5 cellPadding=5 width=""100%"" border=0>"
BodyText = BodyText & "<TR><TD vAlign=top align=left><IMG src=""http://www.aceproject.com/server01/images/logo.gif""><p>"
BodyText = BodyText & "<FONT style=""font-family: Arial; font-size: 9 pt"">"
TaskID = getvalue(rsTask, "TASK_ID")
TaskNumber = getvalue(rsTask, "TASK_NUMBER")
ProjectID = getvalue(rsTask, "PROJECT_ID")
DueDate = getvalue(rsTask, "date_expected_end_task")
Email = getvalue(rsUser, "email_alert")
if session("lang") = "FR" then
FromName = "Notification de AceProject"
EmailSubject = "Rappel pour une tāche"
else
FromName = "AceProject Notification"
EmailSubject = "Task Reminder"
BodyText = BodyText & "********** PLEASE DO NOT REPLY TO THIS TASK REMINDER **********<p>"
BodyText = BodyText & "Dear AceProject user, <p>" & vbcrlf
BodyText = BodyText & "You asked to be notified with a task reminder. " & vbcrlf
BodyText = BodyText & " <a href= " & constURLBASENotification & "login.asp?lang=EN>Click here</a> to login to AceProject. "
BodyText = BodyText & " <a href= " & constURLBASENotification & "login.asp?lang=EN&TASK_ID=" & TaskID & "&PROJECT_ID=" & ProjectID & ">Click here</a> to open this task.<p><p>"
end if
BodyText = BodyText & GetTask(getvalue(rsTask, "TASK_ID"))
BodyText = BodyText & "</FONT>"
BodyText = BodyText & "</TD></TR>"
BodyText = BodyText & "</TABLE>"
BodyText = BodyText & "</BODY>"
BodyText = BodyText & "</HTML>"
SendAlert constMailFrom, FromName, EmailSubject, BodyText, Email
Response.Write("Task reminder sent for the task number '" & TaskNumber & " - Due-Date on " & DueDate & "<br>")
rsTask.movenext
wend
rsUser.movenext
wend
%>
</body>
</html>
Thanks for any suggestions. |
https://squarewheelscycling.com/
https://www.pathlabtalk.com/ |
Edited by - Cliff on 04 August 2004 20:13:43 |
|
Hamlin
Advanced Member
    
United Kingdom
2386 Posts |
Posted - 04 August 2004 : 19:27:40
|
It looks like it can't find the function openrs, is this function in another file? |
 |
|
Cliff
Average Member
  
United States
501 Posts |
Posted - 04 August 2004 : 19:46:05
|
Common.asp is the included file listed above. I found this there, is that what it needs?
' Create forward only recordset using current database and passed SQL statement '------------------------------- sub openrs(rs, sql) Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = adUseClient rs.Open sql, cn, adOpenForwardOnly, adLockReadOnly, adCmdText end sub |
https://squarewheelscycling.com/
https://www.pathlabtalk.com/ |
 |
|
Hamlin
Advanced Member
    
United Kingdom
2386 Posts |
Posted - 04 August 2004 : 19:49:23
|
Its fine it common.asp but you are not including that file. Change.<!-- 'INCLUDE FILE="Common.asp" --> To<!-- #INCLUDE FILE="Common.asp" -->
|
 |
|
Cliff
Average Member
  
United States
501 Posts |
Posted - 04 August 2004 : 20:01:51
|
Oops, I messed that up when I changed the # to ' when I edited the file to be used with SQL instead of Qccess.
I fixed it but still get this error: Microsoft VBScript runtime error '800a000d'
Type mismatch: 'openrs'
/AceProject/server01/Tasksoondue.asp, line 28 |
https://squarewheelscycling.com/
https://www.pathlabtalk.com/ |
 |
|
The Impact
Junior Member
 
Australia
398 Posts |
Posted - 05 August 2004 : 03:23:09
|
IIRC lines 26 and 28 should start with Call. |
 |
|
DavidRhodes
Senior Member
   
United Kingdom
1222 Posts |
Posted - 05 August 2004 : 08:31:37
|
quote: Originally posted by The Impact
IIRC lines 26 and 28 should start with Call.
Call is optional, not needed in this case.
Are you sure openrs is a function in common.asp? Type mismatch in this scenario almost certainly is that it cannot find the function |
The UK MkIVs Forum |
 |
|
Cliff
Average Member
  
United States
501 Posts |
Posted - 05 August 2004 : 13:43:34
|
I posted above the only reference to openrs that I could find in common.asp. Is that what is needed?
Could there be something else with the switch from Access to SQL that is causing this? The page was originally developed for Access 2000. |
https://squarewheelscycling.com/
https://www.pathlabtalk.com/ |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 05 August 2004 : 16:51:43
|
I don't think you've fixed the ' -> # problem yet, but remember that the <!--# should all be together (no spaces) AFAIK. |
 |
|
Hamlin
Advanced Member
    
United Kingdom
2386 Posts |
Posted - 05 August 2004 : 17:15:23
|
quote: Originally posted by laser
I don't think you've fixed the ' -> # problem yet, but remember that the <!--# should all be together (no spaces) AFAIK.
The space is allowed.
|
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 05 August 2004 : 17:26:46
|
Thanks for that, but then I don&t know what else could be wrong  |
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 06 August 2004 : 06:46:45
|
just had a look at this thread - openrs is defined as a sub
sub openrs(rs, sql) Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = adUseClient rs.Open sql, cn, adOpenForwardOnly, adLockReadOnly, adCmdText end sub
subs do not return objects or values, you want a function, probably something like
function openrs(sql) as adodb.recordset Set openrs = Server.CreateObject("ADODB.Recordset") openrs.CursorLocation = adUseClient openrs.Open sql, cn, adOpenForwardOnly, adLockReadOnly, adCmdText end function
and reference it as
'get users if CompanyID <> "" then set rsUser = openrs ("select user_id, email_alert from users where email_alert <> '' and company_id = " & CompanyID)
Would need to destroy the openrs recordset object once finished with it, so this is not the mose efficient way of coding all this, but it would mean you would not have to rewrite your page
hth
|
 |
|
Cliff
Average Member
  
United States
501 Posts |
Posted - 06 August 2004 : 07:25:51
|
Thanks for the help pdrg. I get this error when I try your suggestion: Microsoft VBScript compilation error '800a0400'
Expected statement
/AceProject/server01/Common.asp, line 32
function openrs(sql) as adodb.recordset ---------------------^
|
https://squarewheelscycling.com/
https://www.pathlabtalk.com/ |
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
Posted - 06 August 2004 : 09:38:58
|
umm function openrs(sql as string) as adodb.recordset?
Syntactically, may be way off (It's been a while since the coding edge), but I think the principle is broadly right - certainly cleaner than backreferencing an input variable....shudders
sorry i cannot be more helpful - if you'd asked me 5 years ago I'd have nailed it in a second, but when I do code now, it's all .net :( |
 |
|
Nikkol
Forum Moderator
    
USA
6907 Posts |
|
Doug G
Support Moderator
    
USA
6493 Posts |
|
|
Topic  |
|