Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 Help with asp code
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Cliff
Average Member

United States
501 Posts

Posted - 04 August 2004 :  19:06:38  Show Profile  Visit Cliff's Homepage
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  Show Profile
It looks like it can't find the function openrs, is this function in another file?
Go to Top of Page

Cliff
Average Member

United States
501 Posts

Posted - 04 August 2004 :  19:46:05  Show Profile  Visit Cliff's Homepage
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/
Go to Top of Page

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 04 August 2004 :  19:49:23  Show Profile
Its fine it common.asp but you are not including that file.
Change.
<!-- 'INCLUDE FILE="Common.asp" -->
To
<!-- #INCLUDE FILE="Common.asp" -->

Go to Top of Page

Cliff
Average Member

United States
501 Posts

Posted - 04 August 2004 :  20:01:51  Show Profile  Visit Cliff's Homepage
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/
Go to Top of Page

The Impact
Junior Member

Australia
398 Posts

Posted - 05 August 2004 :  03:23:09  Show Profile
IIRC lines 26 and 28 should start with Call.
Go to Top of Page

DavidRhodes
Senior Member

United Kingdom
1222 Posts

Posted - 05 August 2004 :  08:31:37  Show Profile
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
Go to Top of Page

Cliff
Average Member

United States
501 Posts

Posted - 05 August 2004 :  13:43:34  Show Profile  Visit Cliff's Homepage
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/
Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 05 August 2004 :  16:51:43  Show Profile
I don't think you've fixed the ' -> # problem yet, but remember that the <!--# should all be together (no spaces) AFAIK.
Go to Top of Page

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 05 August 2004 :  17:15:23  Show Profile
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.


Go to Top of Page

laser
Advanced Member

Australia
3859 Posts

Posted - 05 August 2004 :  17:26:46  Show Profile
Thanks for that, but then I don&t know what else could be wrong
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 06 August 2004 :  06:46:45  Show Profile  Send pdrg a Yahoo! Message
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
Go to Top of Page

Cliff
Average Member

United States
501 Posts

Posted - 06 August 2004 :  07:25:51  Show Profile  Visit Cliff's Homepage
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/
Go to Top of Page

pdrg
Support Moderator

United Kingdom
2897 Posts

Posted - 06 August 2004 :  09:38:58  Show Profile  Send pdrg a Yahoo! Message
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 :(
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 07 August 2004 :  09:13:09  Show Profile
vbscript does not support declaring types like your adodb.recordset

take off the as part

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 07 August 2004 :  14:52:33  Show Profile
VBS documentation can be viewed here

http://msdn.microsoft.com/library/en-us/script56/html/vtoriVBScript.asp

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.33 seconds. Powered By: Snitz Forums 2000 Version 3.4.07