What Is Wrong With My If Statment

I'm using the following code on my website:

if left(session("lastPage"), 5) <> "admin" then
session("return") = session("lastPage")
else
session("return") = ""
end if

My problem is even the "left(session("lastPage"), 5) is equal to "admin" it still not equal the variable session("return") to "". Can anyone please tell me why or what Im doing wrong?

View Replies


ADVERTISEMENT

IF Then Statment

i need help with this simple IF then statment.
i want to do this
Code:

IF
response.write objrs ("ok2show") = y
THEN
<img src="http://auditors.demosales.netauditimages<%Response.Write objRS("cnum") %>.bmp" alt="Demonstrator" width="800" height="600"border="7" >
ELSE
<img src="http://auditors.demosales.netauditimagesdefaultimage.jp g"

it's not working it's getting hung up at the response.write objrs part.

View Replies View Related

Sql In Statment

I have an sql statment with an in statment for ID . I'm trying to get the CompanyID in ( ) but all i get is just the word companyID with no value . i used response.write request.form("companyID") so i know the value is coming to the other page, this is what i have now.

Response.Write ("& CompanyID & ")

and this is what i see
& CompanyID &

how do i get the value of companyID in ().

View Replies View Related

Asp Sql End Of Statment

what is missing fromt his sql statment its for an asp page that displays a list of results?

rs.Open "SELECT * FROM downtime WHERE downtime.Entrydate = #" & mediumdate&"# AND Supervisors_name<>"none"", conn,1

i get a message saying expected end of statment and it worked up until i added the AND Supervisors_name<>"none" in to the statment?

View Replies View Related

SQL Statment Variables

I am trying to pass a variable from another page to a sql statment. The variable specifies the one of the columns that I want the sql query to return. I also want to display field contents of the column later in my page. I can't seem to get this to work. Can someone give me a hand? Here is my code:

View Replies View Related

Update Statment

i have this variable:

name="Jones, andrew"

when i update the table it gives an error

here is my update code:

str= "UPDATE tblnames SET Name = '" & name & "' WHERE Id ='" & getid & "'"

can someone tell me whats wrong with it because the name variable has a comma in it.

View Replies View Related

Problem Regarding Asp /sql LIKE Statment

I'm not an hardcore programmer but i try to do a simple search in my asp pages.

I've a database .

I've try this code:

rs.Open "SELECT titre , sstitre , carac , gastro , historique , cepage FROM catalogue WHERE titre , sstitre , carac , gastro , historique , cepage LIKE '"&Request.Form("Sstring")&"'" , conn

But i've that's generate an error in my explorer...

View Replies View Related

Reuse Of A SQL Statment

I have a sql statement that pulls up a certain amount of records according to a requirement. Let's say that 20 records show up. I want to get to the 5th one. Well now I know that I can use the move() function to enable that, but it is the same page.

The page executes the sql statement and by default shows the last record in the query. Now when I ask for the 5th record the page is reloaded, the sql statement exectures AGAIN and the 5th record shows up. Is there way to ask for the 5th record without having to re-executing the SQL statement?

View Replies View Related

ASP/Access SQL Statment

Given the following that results from a form which has multiple checkboxes with the same name value, the resulting string when stored into a variable is this - 129,200,323,330 I used the replace function and got this - 129 OR 200 OR 323 OR 330.

I want to somehow use these values (ints) to specify the particular records in an access database and populate a record set.

When I do this, I get nowhere - "Select * From images WHERE id=" & img_ids
Whereas img_ids is the above string...

View Replies View Related

Database Statment

I've got the following statment in my website:

<%
if session("memberId") = objrs.fields("memberId") then
%>Some Id<%
else
%>Different Id<%
end if
%>

The problem is, if boths are the some number it still displaing Different Id.

Is there anyone can tell me what am I doing wrong?

View Replies View Related

Insert Statment

Now here is my insert statment and it is giving me this error message:

Insert Record
'strSQL2 = "INSERT INTO tblCONTENT_Links (LinkID, ContentOwner_UserGroupID, ContentGrouping, LinkHeaderOrder, LinkDescription, LinkName, LinkURL, LinkHeader, LinkHeaderCategory, LinkRefSite, Active, Archive, UpdatedDate, UpdatedBy, PasswordProtected, CommonLibrary) values ( 141, 7,'public', " & Category & " ,'" & DocumentName & "','" & DocumentTitle & "', '" & Document & "', 0 , 28 , 'www.skyclimber.com', -1 , 0 , #8/27/2004# , 0 , 0, -1)"

IE error:

Syntax error in INSERT INTO statement.

View Replies View Related

If Statment For A Field

how i would go about using an if statment against a field in a database.

i.e

if id = "fieldname"
then
do this
else
do this
end if

I am still learning asp and would be very greatful if someone could help me.

View Replies View Related

Error With SQL Statment

What is wrong with this statment:

SQL = "SELECT tblEmployee.*, tblDepts.deptdesc, tblEmployee.Inactive FROM tblEmployee INNER JOIN tblDepts ON tblEmployee.DeptID = tblDepts.deptid WHERE " & request.form("txtSearchIn") & " LIKE '%%" & request.form("txtSearch") & "%%'" & " ORDER BY LastName, FirstName"

I am getting a error:

Syntax error (missing operator) in query expression 'LIKE '%%%%''.

View Replies View Related

Order By Statment

I am hoping that some one can tell me how to add an ORDER BY statement to the following:

<% set rst = createobject("adodb.recordset")
set rst = conn.execute("select RegClassID, StartDateTime, EndDateTime, Description, Location, SpecialNotes from CAL_EVENTS_REG_CLASSES where RegistrationID = "&RegistrationID)
if not rst.eof then %>

The recordset returns fine, execpt I need to be able to order it ASC

View Replies View Related

Dynamic Sql Statment?

im trying to write a sql statment that will insert a variable number of fields into a database the code below is what i want to do but i know this wont work anyone any ideas?
or even if this can be done?


sSQL = "INSERT INTO sometable("&For Each field In Request.Form ; "&Field&"," next ; &")values"('" "&For Each field In Request.Form ; "&Request.Form(Field) &"','" next ; &""')"

View Replies View Related

UPDATE Statment

I'm using the following code in my website that is not working:

Dim objRS
strSQL = "UPDATE tblasp SET view = " & session("NumberOfViewer") & " WHERE id = " & session("aspId") & " "
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn,2,2

Is there someone please could tell me what am I doing wrong?

View Replies View Related

Insert SQL Statment

i was using INSERT INTO statment for insrting data to a mdb database file

eg

but now it is not working
there is an error

"Operation must use an updateable query. "

View Replies View Related

Group By Statment Problem

i want to display the number of people logged on at each location... when someone logges in they get a type=1... that works great but when i try to group by the NasName thats the location name.. Code:

View Replies View Related

IsNull Update Statment

I need to know how to do this IsNull update statment in ASP:

"UPDATE tblUsers SET username='" & lcUName & "', hash= IIf(IsNull([lcHash]),"",[lcNewHash]), inactive=" & llAct & ", locked=" & llLock & ", isadmin=" & llAdmin & ", attempts=" & lnAttempt & ", lastlogin=" & ldLastLogin & ", onlyreadaccess=" & llOnlyRead & " WHERE UserID = " & lnSetID

View Replies View Related

Find And Replace & For Sql Statment

i have a qs variable that has a & and i need to query the db, what do i replace the & with to query my data correctly?

View Replies View Related

Insert Statment For Two Tables

ContentID is primary_key ID and it is automaticlly created upon this insert, but want to also insert that content id in table Category column ContentId. Code:

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

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

Wrong Code

I'm Trying this code to switch the user group , so this code select users with groups only if the user doesn't have a group or does'nt exist redirect it to another page
Her is my code please check it
Code:

sql="select * from users,groups where users.user_id='"&id2&"' and users.group_id=groups.g_group_id"
set rs=conn.Execute(sql)
if rs.eof or rs("group_id")=null then
Response.Redirect("switch.asp?id="&session("session_id")&"&page=management")
else
dim group
group=rs("group_id")

end if
and It gives me this error message
Error Type:
(0x80020009)
Exception occurred.

View Replies View Related

Wrong User

I have web prgramming to check login. After first time login, I still could login even type wrong password and username, but I need correct login when trying different computer. Is the problem with cache?

View Replies View Related

Wrong # Of Recordset

The output contains only one record it is supposed output 2.. sch_date in db are 10-Oct-07 and 14-Oct-07 ....

Code:

rs.Open "SELECT * FROM schedule WHERE trim(sch_date) between #"&FormatDateTime(trim(x),2)&"# and #"&FormatDateTime(trim(y),2)&"# ",conn
response.Write(rs.recordcount)
response.End()

View Replies View Related

ASP SQL Query Wrong

I am getting the error message

Microsoft VBScript compilation (0x800A0409)
Unterminated string constant

Here is my Query, It is slight incorrect:

newest_sql = "SELECT TOP 5 CatID, ContentID, DateAdded, Title, FeaturedLabel, NewestLabel FROM Content, ContentTypes Where Content.ContentTypeID = ContentTypes.ContentTypeID
AND (((Content.Display)=1) AND ((ContentTypes.ContentTypeId)=4))
ORDER BY DateAdded DESC"

View Replies View Related

ADO Parameter Of The Wrong Type

I've taken over the development of a web app written in ASP. It's not
very well coded. In the live environment it's fine, but on my local
machine it falls over whenever it tries to pass a date to a SQL Server
sproc. No idea why the person before me's been doing all this string
formatting with his dates, but anyway, the error is:

Application uses a value of the wrong type for the current operation.

The dates throughout are in mmddyyyy format, and presumably ADO
running on my local machine wants ddmmyyyy. I'm rebuilding the whole
app in C#.Net anyway so I don't think it's worth me running through
and making this jumble of code international date friendly, so my
question is, where exactly is the date format for ADO defined?
Windows? SQL Server?

View Replies View Related

Wrong Code For Include

I am not sure if this is in the right thread, but...I am making my new website and I haven't been able to get a 'siteinclude' file to work with my default page.
I created a site wide file, basically, includeing the header and table of contents and eventually the footer. I have other sites like this, but cannot figure out what is wrong with this one.
I thought that by putting together a site wide file, i could easily generate many pages that are similar, by adding <!--#include virtual="/siteinclude.asp"--> to the top of the page. Then making the page regularly, save it as .asp and it should have when I just created as well as the 'siteinclude' info, right? Well, the problem I am having is with the default file. It is appearing BELOW the 'siteinclude' info, instead of within it.

View Replies View Related

DatePart Wrong Code

Is there anything wrong with my code (see below) bcoz when 10p-6a shift my
browser returns the error cannot be a zero-length string. Im wondering why,
bcoz the 2 other shift works perfectly.

<%
'Shift: 6a-2p
if DatePart("h", Now()) 5 And DatePart("h", Now()) < 14 then
ShiftID = "A"
end if

'Shift: 2p-10p
if DatePart("h", Now()) 13 And DatePart("h", Now()) < 22 then
ShiftID = "B"
end if

'Shift: 10p-6a
if DatePart("h", Now()) 21 And DatePart("h", Now()) < 6 then
ShiftID = "C"
end if
%>

View Replies View Related

SQL Query Put The Wrong Answer

I have the following SQL in my ASP:

sql="select * from [tblbuy] where Location like '" & request("location") & "' "

The above code is working fine. Now i wondering in case the request "location"
value is: * is it possible to modify my sql statement that will retrieve ALL when the value is * (an asterisk)?

View Replies View Related

Why Do I Get Arguments Are Of The Wrong Type?

Why do i keep getting the following error?

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/_script/main.asp, line 22


I have a simple script that has always worked!

Code:

View Replies View Related







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