Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    ASP




ASP Function


I am trying to locate information on how to call a sub within VBScript on an
ASP page but I can't locate generic information. What I want to do is
generate a page that will stay up but the information on it will change
based on a series of drop down boxes. I need the first drop down box to call
a second dropped down box based on the state that is chosen then city and so
on.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Difference Between Private Function And Public Function?
What's the difference between private and public functions in ASP? When should I use either?


How Can I Add Mail Function To That Post Function
I am using a simple guestbook /portal and i want script to send mail to the thread owner when someone reply his message.

this is the send message code ....

Function Inside A Function
Can I define a function inside a function. e.g;

function abc()
function xyz()
....some code.....
End Function
End Function

I googled this but can't find any related topic.

Function In The InStr Function
I want to use the instr function, but return results from it depending on surtain functions, I can't realy explain so I'll show my example:

I have a string in wich some word I want to find might be in diffrent Capital Letters order, I want the Instr function to return all the values of the place of that word (avcourse I'll run a for and increase the starting point of the Instr func until it returns 0). The instinct thought is to use the Lcase or the Ucase functions, but in this case I don't know how to use them. In the same Idea I wanted to use the Instr Func with the trim Func, But Its realy the same principle if I just understood how to do so.

Asp Function
I am trying to call a function in asp to check to see if a varibale has a value stored in it if there is nothing wite the value NA into it. My code is

<%
Function NullValues(userField)
if userField = "" then userField = "NA"
end function

AccountNo = ""
Name = "sam clowes"
email = ""

AccountNo = (NullValues(AccountNo))
Name = (NullValues(Name))
email = (NullValues(email))

response.Write AccountNo & "<br>"
response.Write Name & "<br>"
response.Write email & "<br>"
%>

When I run this code ALL the variables are blank and nothing is output

XML/XSL & ASP Function
the function
<%
Dim objXML, objXSL

Function ShowXML(strXML,strStyleSheet)
Set objXML = CreateObject("MSXML.DOMDocument")
Set objXSL = CreateObject("MSXML.DOMDocument")
objXML.load(Server.MapPath(strXML))
objXSL.load(Server.MapPath(strStyleSheet))
Response.Write objXML.transformNode(objXSL)
Set objXML = Nothing
Set objXSL = Nothing
End Function
%>


calling the function in an asp file
<%Call ShowXML("http://msn.foxsports.com/feedout/syndicatedContent?categoryId=142","nhl/xsl/news/teamNews.xsl")%>


the errors
1. the http:// part
2. and the ? mark

the error message says that the path has been typed wrong.

Function
the user can key in variable A and B
then C is auto generated by C = A / B

so how and where should i write the C function??

XML Value Into ASP Function
Possibly a very simple question but how do I get a value out of an XML document so I can play with it in ASP

E.G: <Name>Tom</Name

How do I pull the work tom into asp

Mid Function
6408373-SALE-11/1/2007

From string, i want to extract "SALE"

How to do it using mid and Instr ?

Also,

6408373-DECLINE-11/1/2007

From string, i want to extract "DECLINE".

How to do it using mid and Instr ?

Now() Function
I am using the now() function to be displayed on an email after a form submission has been sent. The problem is that the server is not in the same timezone as I am for the result. How do I adjust the hours on the now() to allow for this please ?

Sub Or Function
I know the basic difference between a subroutine and a function is a
subroutine performs a task and a function performs a task and returns a
value. The Call keyword is required when using parens with subs with more
than 1 parameters. Parens around values passed are ByVal vs ByRef and is a
waste of processing if passed ByRef for no reason.
I am told there is no reason to ever use a subroutine as a function can be
used even if it doesn't return a value. While this appears to be true, is
there any reason why it's ever a bad idea to use a function, instead of a
subroutine, that doesn't return a value? Are there memory, performance,
etc. issues?

Asp Function
I have a column in the table which contains 2 full names seperated by "&" (e.g: Joe Smith & Jeff Scott) I want to display only the first names of the whole record in an asp page. Is there an asp function using which i can do this?

Mod Function
im using the mod function to create a calendar for me, which everything works perfectly, all is totally well with that!
but...when i use the mod function it churns out this loooooooooong string which is the whole table...
if there is some way that i can insert hard breaks IN THE CODE ITSELF.

NaN Function
I used to be quite an experienced ASP programmer but I haven't used it for a while

I’m trying to do something that I remember as very simple I'm trying to check that the value of a form text box is numerical using the isNaN function. The code I am using is:

<%
quantity = Request.Form("number1")

if isNaN(quantity) = true then
Response.Write "Your input was not a number"
else
Response.Write "Your input was a number"
end if
%>

All I get is a NaN type mismatch error.

Contains Function
Is there a function to check to see if a string contains a space
Thanks

Mid Function
I was just wondering when using the mid function how does the assigment work when the length is longer then string itself? For example

test = mid(12345, 1, 10)

What would be the end result of test?Would it be 0000012345 or 1234500000 or 12345?

Mid() Function
When I create a single character string

var str = "A"
'convert to ascii
num = asc(str)
Response.Write num ' 65 shows up
'when I have a whole string
str = "hello"
str = mid(str, 1, 1) ' return 'h'
num = asc(str)

'I get an error:

Invalid procedure call or argument:'asc'What can be done to fix this?

Use Asc() Function
I've an array to store alphabets, in my code...in a random order. How can i use the Asc() function to get the equivalent Ascii of each alaphabaet of that array....
whenever i use ,

for i = 0 to NoOfElements
Response.write Asc("ArrayName(i)")
next

it displays 65, "NOOfElements" times (ascii of A)...on the other hand..i can't write

Response.write Asc(ArrayName(i))

since this shows some error...How can i solve this?

Function To Be Available
Depending on some situations, I or the user, need to execute a function (e.g., login, sending email, etc...) and then continue from the original place. How can I make one function to be available from any page from my site?

Max() Function
I have a problem with max() function. The SQL is as follow SELECT max(group_no) as group_no FROM doc_groups. if I run the sql in MS SQL server, it will return correct result. However when I run in ASP file, there is no record return. I check with RecordCount property and it return -1.

PV Function In ASP
Does anyone know how to use the Excel PV Function in an asp page? Is it possible at all? I know how to use it in .Net but not in ASP.

Mid Asp Function
i need to write sql statment to compeare the first three letters btween input user and a field in a database, i used the Mid function but it seems there is something wrong ..

dim str1
str1= Mid((Form1.SiteName.value), 0, 2)
<% strSQL = "SELECT EQUIPMENT_ID FROM ne.equipment_view WHERE Mid([EQUIPMENT_ID], 0, 2) = '&str1&'" %>

by the way i use dropdown list for user input ....

URL Function
I need function that will recognize URL in some string. For ex. somebody in forum sends some text which is in variable TEXT. I want a function to look at it and if it finds www... , http://... or https:// - he has to change it into url link.

Copy Function
is there a vb function that I can use to copy chars 1, 3, 5, and 7 from a string of 7 chars?

Session Function
Here's a tricky question for you all, is it possible to have a session or global function?

Page1.asp
<%
Function Hello()
Hello = "Good Bye"
End Function
Page = "Page2"
Server.Execute(Page & ".asp")
%>

Page2.asp
<%
Response.Write(Hello())
%>

However, When I run the pages, nothing is returned. Without using page includes, is it possilble to create some sort of global function?

Logout Function
I have 3 frames in my page. When i log out i would like to replace my framed page with another page. I tried using the link below but nothing happens. Code:

Function-Last Login
i want to display the last login time and date in my portal.asp but however i search thr w3school.com and try out but still unable to do.

How To Use The DatePart Function?
Does anyone know how to use the DatePart function?

Trim Function
i'm having some trouble with the trim function. I have a date 04/18/1982. I want enter the value 1982-04 into the database. The code i'm using is:

strEXPDT = replace(right(left(request.form("Expiration_Date")2)4),"'","''")

SQL Function Question (sum)
I want to use the sum function in SQL, but once I query and calculate the DB, how do I exactly display the result?

What Is The Mail Function In Asp
What is the mail function in asp?

ASP Date Function
How do I convert 12/15/1985 to 15 December 1985 format using classic ASP?

Function Code In ASP
I have a code In asp, but i don't know this function.below is code:

1.if instr(strq,"http://localhost/ab") > 0 then
...........
else
...........
end if

2.fid=replace(fid,"pdafid_","")

1.What function the code "instr"?
2.What function the code "replace"?

ASP Replace Function
I've tried EVERY way i can think of to do this replace function, basically when i go to insert "Do's and Dont's into the database it cuts it off at "Do" because of the ' now ill show you my section of code that i have it in currently:

curdescription = trim(replace(arrTemp(4), "'", "''"))

I have it this way and it doesnt work, and i even had it

curdescription = trim(arrTemp(4))
curdescription = replace(curdescription, "'", "''")

Compare Function
I store e-mail addresses in a database that are to be used for notification purposes. When the clients add e-mail addresses I want to check and make sure they have not entered an e-mail addresss in twice. Here is what I've got:

I have two arrays that hold the email addresses from the database and the email addresses from the form. I want to loop through the form's array and check it against the database array. If it finds a match then add it to an error message. If it does not find a match add it to the database. Sounds simple.

Here is the function that does the comparison: Code:

Split Function
I want to take a server variable and split it. It would look something like this:

varServerVariable = fistname.lastname

I want it to look something like:

first = firstname
last = lastname

I know that I need to use the Split Function, but I'm not sure of the syntax.

ASP Aggregate Function
I have been searching the boards trying to find an answer to this
question and no luck. I am using a query similar to this:

Select count(col1) from table1

I was having a hard time accessing the count information. After
reading for a while the following SQL examples were given to correct
this issue.

Select count(col1) Blah from table1
Select count(col1) As Blah from table1

Then, supposedly, I am able to access the data using the following:
rsQuery("Blah")
- or -
rsQuery(0)

Neither the rsQuery("Blah") or rsQuery(0) allows me to access the data.
I get the following error.

------------------------------
Provider error '80020009'

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.

/CallLeveraging/assets/forms/adhoc_popup.asp, line 0
-------------------------------------------

The database is Oracle 9 and IIS 6 is the webserver.

Mid() Function Crippled?
Is there a reason why the Mid() function only works in one direction in
VBScript? This code works in VB6 but not in VBScript? Is there a way
around it? I am trying to create an ASP page which produces a fixed width
text file for import into a third party legacy application which I don't
have control over.

--code sample--
Dim strSomeString

strSomeString = Space(100)

Mid(strSomeString, 1, 4) = "test"
Mid(strSomeString, 10, 20) = "Something else"
--end sample--

Call ASP Function
I have a form which checks email addresses. On submitting the form i have some JavaScript checking the format of the email address, once this has been completed successfully I would like my asp function to run. On successful completion of that I would like my form to be submitted to another page. Is this possible?

Time Function Like Follows
I want to make a function that connects to my mysql database and ranks the users who have achieved the most points during that day. How would I structure something like this?

Function Or Script
I wanted to display links of other websites in under my header and footer.
that is ok i got it.
but i have a lot of links of other websites. I need to create different different pages of all links.
is there any fuction or script in asp that which help me all links in only one page

as like
but it didnt work

DateAdd Function
This sort of stuff really gets me!I've been using the DateAdd function in various places to return results from the last 3 months e.g.

Code:

SELECT * FROM table WHERE publicationDate > #" & DateAdd("m",-3,now) & "#"


It's been working fine until today when I get into work and suddenly no records are showing up.If I substitute a date from 3 months ago for the function, the records reappear.

Calling Function From Asp
I have the following problem. I want to call a JavaScript Function from ASP
I am reading back values from a db and based on those values I want to check a checkbox.
If the value in the db field in yes then I want to check the checkbox but if it's no I want to leave the
checkbox unchecked.
My alert box is displaying but Im getting an error at the line
document.getElementById("chkStatus").checked = "true";

ASP Function Browser
Does anyone know how can I get Visual Studio to show a classview-like
function browser for my asp files? (For VBScript functions.) It would be
enough if it showed the functions in the asp file I'm working on, even
better if it showed all the functions in all the .asp and .inc files in a
project.

Function Syntax
I have a replace function which should replace a smiley tag with the HTML for the smiley image.
can you tell me where this is going wrong please?
Code:

FUNCTION insertSmilies( tempString )
tempString = replace(tempString,":D ", "<img src=""images/smilies/icon_biggrin.gif"" width=""15"" height=""15"" class=""subScript"" /> ")
insertSmilies = trim(tempString)
END FUNCTION

The HTML output looks like this:

Code:

<img src=''images/smilies/icon_biggrin.gif'' width=''15'' height=''15'' class=''subScript'' /

I can't arrange the speach marks to output the full image tag,it keeps leaving off the end.

Problem With MID Function
I need to extract the contents between <title> and </title> from a text file which contains source of a html file. For this I have this Code:

Paragragh Function
I'm trying to avoid writing a summary textarea. Does anyone have a function that will extract the first paragraph of a document.

DateDiff Function.
taken from hafiz's thread. i've got problem to check the user's last ectivity which is more than 20 minutes.which one is correct??? this one:Code:

'check if current user's last activity was more than 20 minutes ago

If Abs(DateDiff("n", rs1("LastActivity"), Now()))> 10 Then

or this one Code:

If Abs(DateDiff("n", Now(), rs1("LastActivity")))> 10 Then

the LastActivity datatype is a Text?

Replace Function
I'm trying to use the replace function to change a variable ie like this:-
replace folder_old, txtOldFoldername,folder_rename

folder_old = c:DocumentsRoot_Testob
txtOldFoldername = bob
folder_rename = newfoldername

all i want to do is to beable to change the name bob to the new folder, is there a easier way to do this or am I on the right track. if i do the replace like this replace(folder_old, " & txtOldFoldername & "," & folder_rename & ")
i get this error:-
Cannot use parentheses when calling a Sub


Copyright © 2005-08 www.BigResource.com, All rights reserved