[thelist] returning values through ASP function

Matthias Ritzkowski Matt at grndwtr.com
Thu Mar 7 09:30:01 CST 2002


Hi all!
Expert help needed please.

I am trying to write an ASP function to return a value. I want to store the
function in an include file.


So, I have to pages:
****Code for page 1****

<!--#include file="../_ScriptLibrary/myfunctions.asp"-->
<HTML><HEAD><TITLE>Page 1</TITLE>
<%
Sub Button1_onclick()
strPN = Textbox1.value
strCurrent = max_ld_sample(strPN)
Response.Write strCurrent
End Sub
%>

</HEAD><BODY>
Enter the project number
... code for textbox goes here ...
... code for button_1 goes here ...
</BODY></HTML>
****END Code for page 1****

*** code for page 2 (include page****

<SCRIPT LANGUAGE=vbscript RUNAT=Server>
'*** retrieve maximum ld_samples so far
function max_ld_sample(myValue)

set OraDatabase = OraSession.getDatabaseFromPool(10)
OraDatabase.AutoCommit = true
dim strSQL
strSQL = "SELECT MAX(SAMPNO) FROM LD_SAMPLE_IN_TABLE WHERE PROJNO LIKE
'"&myValue&"'"
Set OraDynaset = OraDatabase.CreateDynaset(strSQL, 0)
strMAX_SAMPNO= OraDynaset.Fields("MAX(SAMPNO)").value
set OraDynaset = nothing
strCurrent = strMAX_SAMPNO
'Response.Write strCurrent
return strCurrent

end function
</SCRIPT>
*** END code for page 2 (include page****

If I use the response.write , which I have currently commented out, value is
written to the screen ok.
But I just want to have the numeric value available to me in a string on
page 1.
Using return throws an error ...
This does not seem to far fetched, does it?
 Regards
Matthias Ritzkowski



More information about the thelist mailing list