Embed A SELECT CASE Statement In An IF Statment

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:

View Replies


ADVERTISEMENT

Select Case Statement

Code:

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?

View Replies View Related

Dim Inside Select Case Executes In Any Case?

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?

View Replies View Related

Execute SQL Select Statment Error

I'm getting this useful error '80040e14' when trying to run a select statement in an ASP page. The connection to SQL Server 2000 is ok. The variables in the Select statement, 'area' or 'areaid' are passed through form the previous page ok.The code is below... Any ideas? Is it something obviously dense on my part?? Code:

View Replies View Related

Selecting Multiple Tables Using SELECT Statment Problem

I am Trying to use the SQL SELECT Statment to open records from multiple tables into one recordset.

I know the basic syntax of the Select statment but I wanted to know if its possible to recive the table name from the feild or the record that I am readinf from the recordset in any given moment.

To make things more clear, my example:

-Open a connection

SQL = "SELECT * FROM TABLE1,TABLE2 WHERE TABLE1.UserID=" & uid & " And TABLE2.UserID=" & uid

rs.open sql,conn,3,3

while not rs.EOF

-read from record

rs.movenext
wend
rs.close
conn.close

now, in the part that I read from the record, is their any way I can know if that record is from table1 or table2?

View Replies View Related

How To Use Select Case

I was trying to colorize my Events from my eventtable.
Past = Grey
Today = Yellow
Future = Blue

Now my question:

How can i specify a statement not when its EQUAL to a number but greater or less than zero for example

I tried this thing and some else but it didn't really work...

color="#6464ce"
Case Else
color="black"
End Select

Probably its a simple solution and don't see the forest because there are so many trees

View Replies View Related

SELECT CASE In ASP?

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:

View Replies View Related

Select Case Between Value

"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

I also tried Case > 0 And <30000 .... and so on

how to write this select script please?

View Replies View Related

Case Statement

I am getting a syntax error on

Select Case Now
Case > "2/2/2004 12:30:00 AM"
response.redirect "votingover.asp"
case else
m=0
End Select

View Replies View Related

Select Case Alternative

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?

View Replies View Related

Select Case Error

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
%>

View Replies View Related

Select Case Variable

I have an array made using split to create act_count variable below I am then using a select case to write names from array.. Code:

View Replies View Related

Select Case Compare

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
...

View Replies View Related

Case Statement Redirect With Pop

I'm trying to build a case statement that when a person logs in, the login page sends them to a redirect script based on the query string redirect.asp?id=1.

So far i can make myself a basic case statement, but i'm confused on how to get the window to pop up in a 400 x 600 window with no tool bars and such. any ideas?

View Replies View Related

Select Case And Combine Two Numbers

i have two numbers that i need to combine and then depending on the result i need to write different instructions to the browser. Code:

View Replies View Related

Select Case Syntax Error

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?

View Replies View Related

Select Statement

how do you select all the fields in a table that do not contain any data?? I have tried the below and it wont work??

View Replies View Related

Select Statement

I am trying to display a feild from the table. But there is a Type Mismatch error that I am getting. Can anyone please take a look at my code to see what could be wrong.

The error that i am getting is:
Microsoft VBScript runtime error '800a000d'

Type mismatch

/jobapplicationnew.asp, line 1285
Line 1285 is highlighted.

Code:

View Replies View Related

Select Statement

following is my select statment code, works partially fine but the city search is not working.. i.e it gives me list of all hotels that start with the given words whereas it should give me hotels in the given city only. pls help me out. thanks

sSQL = "SELECT * " _
& "FROM [hotel] " _
& "WHERE hotel_name LIKE '%" & Replace(hotel_name, "'", "''") & "%' " _
& "OR hotel_name_e LIKE '%" & Replace(hotel_name, "'", "''") & "%' " _
& "and city = '"&city&"';"

View Replies View Related

Select Statement

the select statement as per the following relationships:

drop1id has 1 to 9 records.
drop2id has 1 to 65 records - FK drop1id will be 1 to 9
drop3id has 1 to 356 records - FK drop2id will be 1 to 65
drop4id has 1 to 356 records - FK drop3id will be 1 to 356.

I am not sure how to retreive the records based on their relationships.

View Replies View Related

Select Statement

does anyone know if its possible to look through a field in a database and see if it contains certain keywords?

i am using a database with a field called MainIssue and i want to see if it contains keywords and if it does, to display the contents. is there a command which would do the same thing as:

select * from maintable where field contains "keywords"

View Replies View Related

Select Statement

I am having problems with a select statement in asp with an access database.
I pull First and Last information from my form
First = Comes from form
Last = Comes from form
I have validated that the form information is being pulled this is where my problem lies.
Code:
SQL = "Select Listing where (FirstName =" & First & ") AND (LastName =" & Last & ")"
For some reason I can not pull the information for the database using this. If I take the AND (LastName =" & Last & ") out I can pull some of the information, but I am looking for a specific last name, first name entry.

View Replies View Related

Select Statement

i have the following tables in my Access database

info1, info2, info3...

all tables have the same columns with the same type of data.

code, description, activated etc.

now i ask the user to enter a code, and then it searches through all the tables for that code. the reason i broke it into smaller tables is there is 10s of thousands of records.
it should find the record that match with the entered code and then if the user wants to, he can edit the data, the date is then automatically saved into the record as well.

View Replies View Related

Select Like Statement

Some of my pages include paging where the variable starts with a certain letter. This worked fine in access but when I try to run it with mysql it says...

Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

[MySQL][ODBC 3.51 Driver][mysqld-4.0.17-nt]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT username, status FROM users WHERE username Like 'A%' OR

View Replies View Related

Select Statement

This is really simple but for some reason no recordset is returning. I can't get cat_1 to write. I have run the query against the database in Query Analyser and it runs fine.

Code:
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = "Driver={SQL Server};Server=nzlakldwhse;Database=Complaints;Uid=elkuser;Pwd=elk;"
objConn.Open

Dim objRS
Dim cat_id, cat_1, cat_2
set objRS = objConn.Execute("select cat_id, cat_1 from complaints.dbo.category a where a.cat_id = '"& request.form("cat_id") &"'")

response.Write(cat_1)
response.End

View Replies View Related

Select Statement

Code:

[advsearch = "Select * from img_inv where item_num like '%" & item_num &"%' or category = '" & category &"' order by item_num"



I want it to be able to search the db by like item number or exactly equal it a given category list.

View Replies View Related

SQL Statement Select

How do i get this to work, i have 3 colums forename, surname and groupname and a colum Genre. I want to select any of the 3 first colums for a name, where the Genre colum is X
this is the statment i have
Code:

"select * FROM autos WHERE forename LIKE '" & session("name") & "' OR surname LIKE '" & session("name") & "' OR groupname LIKE '" & session("name") & "' AND genre LIKE '" & session("genre") & "'"


this is what i get :-
select * FROM autos WHERE forename LIKE 'david' OR surname LIKE 'david' OR groupname LIKE 'david' AND genre LIKE 'Football'
giving David and 'session("name") and Football as session("football")

View Replies View Related

SELECT Statement

I've inherited a database with NULL values in it. I plan on fixing this problem, but for now I need to get this statement working.

cmd = "SELECT * FROM EmpInfo WHERE Interview <> NULL AND status IS NULL OR status <> 'D'"

I'm trying to pull information from the table that need to conform to two different rules. First, there needs to be a value in the INTERVIEW column.

Second, the column STATUS has to be NULL, there can be no D (for delete) in the record.

I can get it to pull the records following the conditions for STATUS, but not for INTERVIEW. I don't work with NULL values very often, so this one is throwing me for a loop.

How can I write that statement to pull only those records that are not NULL in one column, but NULL in another?

View Replies View Related

SELECT Statement

In my company one of the people who works for me has done this:

sqlText = "SELECT products.ProdID, productName, " _
& "productPrice, quantity from products, " _
& "itemsOrdered where " _
& "products.productID = itemsOrdered.productID "_
& "and itemsOrdered.orderID = " & intOrderID

I am just a little unsure what products.ProdID means when later on in the string there is the FROM products?

View Replies View Related

Select Statement

i give the users the option to choose between a daterange to get data from the database.

For example
(RADIO BUTTON) Last 7 days
(RADIO BUTTON) Last month
(RADIO BUTTON) Custom dates

Got the custom dates part to work, but how do i write my select function to select todays date and then go back seven days / 1 month(30days)?

View Replies View Related

Select Statement

In a select statement How do i select the last 10 records in a database?

View Replies View Related

Select Statement

I've got a client who needs some ASP's coded for a Unix server running ChiliSoft, (I had no say in the matter).

I'm banging my head against a wall with the following code:
[VBS]Set objRs = Server.CreateObject("ADODB.Recordset")
Set objRs.ActiveConnection = objConn
objRs.Open "Select * From tblDataBank_Summer Where DatabankID = " & intDatabankID, , adOpenStatic, adLockOptimistic, adCmdTable[/VBS]

I've used this coding elsewhere on other sites with no troubles, but here I keep getting:

ADODB.Recordset.1 error '80004005'

SQLState: 42000
Native Error Code: 1064
[TCX][MyODBC]You have an error in your SQL syntax near 'Select * From tblDataBank_Suummer Where DatabankID = 114 ' at line 1

View Replies View Related

Select Statement

how to do a select statemtn like below

SELECT * FROM table WHERE ID =" & strID & " AND Users LIKE " & strUserName

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved