Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
FUNCTION OR PROCEEDURE : Output result set
Old 08-04-2005, 07:13 AM FUNCTION OR PROCEEDURE : Output result set
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
HI there,

I working with ASP and Access.

I wish to not output my query results within the HTML and output from a procedure or function (i am not sure which one to use) which is called from with in the htl,

By this I mean, where my result set would be output , i wish to use say a
<%= getResults() %>

and the procedure/function use document.write("")

MY QUESTIONS : do I use a function or procedure? Whats is the syntax? and do I use
document.write("html")
Are there any other rules I should remember?

cheers

Steve
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 08-04-2005, 01:32 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Your post is very contradictory so 'fraid I don't totally understand what you are asking

"I wish not to output my query results" then use <%=getResults()%> which would actually output the function results with the HTML

using a function or subroutine is up to you.
The difference is a function can return a value while a subroutine doesn't.
A function would be written as (simple example)
Code:
<%
function getResults()
dim a,b
a = 3
b = 5
getResults = a * b
end function
%>
For useage a function can be;
<%=getResults() %>
The "=" sign is shorthand for response.write() in an inline call (surrounded by delimiters "<% %>"
so in code segments it would be
response.write(getResults())
to output the return value or
variable = getResults()
to set a variable to the return value.
A subroutine can process values but any output must be done within the sub
Code:
<%
sub getResults()
dim a
dim b
a = 3
b = 5
response.write a * b
end sub
%>
And a subroutine can be called as
getResults()

This would simply write the value of a * b wherever the routine was called and the same syntax is used for inline or code segment calls.

HTH


NOTE the above is assuming you are using vbScript for the asp language and not JScript.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-05-2005, 08:32 AM
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Thats great. Thanks very much.
Steve
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Reply     « Reply to FUNCTION OR PROCEEDURE : Output result set
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.53420 seconds with 12 queries