SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Development Tools
 Other Development Tools
 Classic ASP - If Statement
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dzach
Starting Member

38 Posts

Posted - 12/19/2008 :  15:43:24  Show Profile  Reply with Quote
I have the following ASP code that works fine, up to the IF statement. I'm trying to display an image based on the result of the MachineName variable.

I'm getting "incorrect syntax errors" where the IF statement begins.


Code:

set rsqdb = conn.Execute ("Select MachineName, KPName, Severity, " _
& " EventMSG + '; ' + AgentMsgShort as EventMessages, DateAdd(ss, LastOccurTime-3600, '1969-12-31T18:00:00.000') as OccurTime " _
& " From Event, EventDetail " _
& " Where Severity < 6 " _
& " AND Status = 0 " _
& " AND EventDetail.EventID = Event.EventID " _
& " AND AgentMsgShort <>  'NULL' " _
& " AND CAST(FLOOR(CAST(DATEADD(S,LastOccurTime, '1969-12-31T18:00:00.000') AS FLOAT)) AS DATETIME) >= (getdate() -1 ) " _
& " AND EventMSG NOT LIKE '%Work Queue Length%' " _
& " AND EventMSG NOT LIKE '%DRA Outbound%' " _
& " AND EventMSG NOT LIKE '%Report Creation Failed%' " _
& " AND EventMSG NOT LIKE '%NCOGateway%' " _
& " AND EventMSG NOT LIKE '%Diagnostic Console%' " _
& " AND EventMSG NOT LIKE '%Pdsk%' " _
& " AND EventMSG NOT LIKE '%EventLog does not exist%' " _
& " Order By OccurTime DESC " _
 
&" If Machinename = 'enpefr' then " _
&" <img src="map10.jpg"> " _
&" end if ")


Any help is appreciated!

jsmith8858
Dr. Cross Join

USA
7423 Posts

Posted - 12/21/2008 :  20:56:56  Show Profile  Visit jsmith8858's Homepage  Reply with Quote
The part at the end isn't SQL code, it's ASP code. It should not be in quotes and it should not be concatenated with your SQL statement.



- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

dzach
Starting Member

38 Posts

Posted - 12/22/2008 :  08:51:54  Show Profile  Reply with Quote
Thanks!!
Go to Top of Page

jl2
Starting Member

2 Posts

Posted - 01/20/2009 :  11:34:04  Show Profile  Reply with Quote
I'm pretty new at this stuff, but shoudn't there be a beggining <% and %> to comment the if statement out?
Also, the IF statement's quotes should be double quotes, not single
Go to Top of Page

jayvee88
Starting Member

Philippines
2 Posts

Posted - 02/24/2013 :  06:40:56  Show Profile  Reply with Quote
no, the single quote on the string is right, if it's a double then the line ends on the equal sign..
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000