I would like to know if there is alterntiave to using Select Case?I have over 80 files that a user can select from a drop down list and 'read'. Rather than writing out 80+ lines with INC files, what is the other less code option?
In VB there is a command that can be used to convert a string into proper case, e.g...
msgbox StrConv("HELLO", 3)
Would say "Hello". However, there is no such function in ASP (it seems to be one of the few commands that was not exported into VBS....god I miss DoEvents too....used to abuse that command.....lol).
Anyway, do you guys know any methods that can be used to do the same thing? Basically I have a name all in CAPS, and I want it to be converted into Proper case so that it's easier on my visitor's eyes when they see it.
Code like this ======================= Select case q Case "a" Dim arr(5) Case "b" Dim arr(2) end select ===================== returns an error saying variable arr redefined. Should it be like that or an I using Select incorrectly? Perhaps something similar to break needs to be used?
My users have to select an value from a fixed selection of values. The obvious choice of control for such a requirement is to use a <select> (i.e. a combo box).
My problem is that sometimes, these combo boxes will have a *large* number of values. There could be any number of values in them from 5 to 5 million (unlikely it would be this large but possible).
Obviously 5 million is far too much to populate a <select> control with. Does anyone have any suggestion as to how a user could select a value from a *potentially* very large selection of values (i.e a suitable alternative to the <select> control)?
I am having a hard time understanding how to use a SELECT CASE in ASP. I have used it in VB but never in ASP scripting.
Scenerio:
I have 2 textboxes on a form that I have to allow entry to one or the other or Both at the same time. Now I tried to use an If ElseIf but it got too hard to track, so now I am using a SELECT CASE Statement.
TEXBOX1 named strEnglish TEXBOX2 named strFrench
My code: <% strEnglish=Request.Form("strEnglish") strFrench=Request.Form("strFrench")
Select Case
Then I have no idea how to go from here, because I have 2 input textboxes to follow. Code:
"Stock Value" Could be anything from 0 to a million or so, and might include a decimal (12345.67) . I can't find how to do this:
Select Case StockValue Case 0 To 30000 response.Write("Less than 30000") Case 30000 To 80000 response.Write("30000 to 80000") Case 80000 To 180000 response.Write("80000 to 180000") Case Else ' > 180000 response.Write("Greater than 180000") End Select
Using keyword "To" in select case giving error.The following code is got from www.microsrosoft.com itself. What is the wrong with this?.
<% Dim Number1 Number1 = 7 ' Initialize variable. Select Case Number1 ' Evaluate Number1. Case 1 To 5 ' Number1 between 1 and 5, inclusive. Response.Write( "Between 1 and 5" ) ' The following is the only Case clause that evaluates to True. Case 6, 7, 8 ' Number1 between 6 and 8. Response.Write( "Between 6 and 8") Case 9 To 10 ' Number1 is 9 or 10. Response.Write( "Greater than 8") Case Else ' Other values. Response.Write( "Not between 1 and 10") End Select %>
Function SetAvgClass(val) If NOT isnull(val) Then Select Case cint(val) Case (val < 100) SetAvgClass = "belowexpected" Case (val > 100) SetAvgClass = "aboveexpected" Case 100 SetAvgClass = "expected" End Select Else SetAvgClass = "belowexpected" End If End Function
The only case that seems to be working correctly is thw case 100. am i using incorrect syntax for the > and < statements?
I'm doing a form validation function in ASP. I have a password and a passwordVerify field that must be the same value. In a Select Case, how can I compare the two values?
Case "password" If Len(sFieldValue) <4 or Len(sFieldValue) >20 Then bFieldIsOkay = False Case "passwordVerify" If sFieldValue <> (someway to compare password) Then bFieldIsOkay = False ...
I'm getting a syntax error with a Select Case statement:
Select Case CSng(rs.fields("Field1")) Case 0 Response.Write "Test1" Case Is < 0 <<< Syntax Error Response.Write "Test2" Case Is > 0 <<< Syntax Error Response.Write "Test3" End Select
As far as I can tell the syntax *is* correct. What am I missing?
i have a select case statement that checks for a couple of options e.g.
<%select case aParameters(0) case 0 %>
.. some code
<%case 2 %>
however i would like to test for a certain condition within the select cases statment. To see if a session variable exists before implementing some code:
I need to filter the records of a table where the records contain a searchin string with no case sensitive compare, and all with one only sql statement.
"SELECT * FROM Stuff WHERE LOWER(StuffName) LIKE '%" & lcase(StrSearch) & "%'"
but the error is in the function LOWER exist a similar function ?
I have got the following PHP code which I am trying to convert to ASP.cant find a replace function for Unset in asp which will discard the variable if ($categoryid == "all") { $sql = "SELECT * FROM products where shopinspection=$shopinspection"; unset($HTTP_POST_VARS['categoryid']); unset($HTTP_POST_VARS['shopinspection']); } else { $sql = "SELECT * FROM products where categoryid = $categoryid"; unset($HTTP_POST_VARS['categoryid']); } unset($HTTP_POST_VARS['Submit']); while (list($key, $value) = each($HTTP_POST_VARS)) { if ($value != "" ) { $sql = $sql .=" AND $key=$value"; //$sql = $sql .=" AND solesource = $solesource"; //echo "<strong>$value</strong>";
i have read a few articles saying that you can run IIS on XP home but it does not look too reliable to me and am not too willing to try, so is there an alternative set-up i can use to test my ASP before uploading?
i say this as all ftp hosts seem to want your code pre-tested before uploading .
Looking for a way to switch between submit buttons. The default will be "start" and when the tech clicks on that, the button will start a timer, which I have already set.
The button then will switch to "stop" and when a tech has completed a job and clicks "stop" the timer will also stop and switch the button back to start.
I know how to track the time for each tech that starts and stops a job. I need a jumpstart on how to switch onclicks for two buttons.
I would like to set up an ASP page that sends an e-mail, but the server I'm working on doesn't have CDONTS installed for security reasons. I don't have any control over the server. Are there any alternatives to using CDONTS that will work or a better option?
Is there any other way or trick to include an asp file in my ASP file than the classic html #include. In fact my filename (which is to be included) will be coming from database and #include statement doesn't support any kind of variables.
I know this is not a core .asp issue, but I'll try anyway. I've used the TEXTAREA element for a while, but as you know it's limited when it comes to formating part of the text inside a TEXTAREA.Does anyone have expirience using other text cointainer objects (Java/ActiveX), which is easy to use and easy to read values from when sending a form to a procedure .asp page?
I'm using ASP and I need to generate a ZIP file that contains a list of files that I'm pulling from a database. I've determined WinZip's command line parameters so that I can use it, the problem is I'm unsure how to run WinZip on the server.
Set WshShell = Server.CreateObject("WScript.Shell")
WshShell.Run("c:winzip.exe")
Assuming this would work, how do I get the process to terminate upon completion? I can't have 20-30 WinZip applications running on the server, I need it to handle what I send to it and then close. Maybe I'm taking the entirely wrong approach here.
I have an asp file that gathers info from a form and sends to the database. im now changing the location of the database from the root path. I think that because of this i cannot use Server.MapPath method of sending data.
Coudl someone please help me out and let me know how i would change the code? Im quite new to this as you could probably see. Code:
Is there an alternative for CDONTS.NewMail for sending email? according to this article , CDONTS.NewMail works only on Windows NT/2000 Operating Systems.
Is there an alternative class that works on Windows XP to send email?
i am using cookies to save a users login information which is then used again on another page to save data to a database. This works fine on certain clients' machines, but on others there is an error. Am i right in saying that it is because cookies are not enabled on their machines? If so, is there another way i can do this?
I'm trying to build a contact form using ASP. The form works properly but the code I found has "Response.write "Your email..." which appears on a white page after the form is successfully submitted. Is there a different function I can use that will redirect the use to another .html page (like a "thank you for submitting...") instead? Code: