ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 25th, 2012, 07:53 AM
kyithar kyithar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 16 kyithar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 26 m 16 sec
Reputation Power: 0
Microsoft VBScript compilation (0x800A0401) Expected end of statement

Hi,

I have a dropdownlist and from that ddl if I choose one of the fields

and submit, all of that fields data come out. Like search filter.

My code is as follow but I dont know why I got above error.

Please, can anyone advice me. Thanks in advanced.

Artistic_Fields = Trim(Request("Artistic_Fields"))

If IsFields(Artistic_Fields) Then
sql = sql & "AND (rs("Artistic_Field_Film") = #" & Artistic_Fields & "#) " [highlight]////// The error is show up here end of line before " (double code)
End If

If IsFields(Artistic_Fields) Then
sql = sql & "AND (rs("Artistic_Field_Literary_Arts") = #" & Artistic_Fields & "#) "
End If

If IsFields(Artistic_Fields) Then
sql = sql & "AND (rs("Artistic_Field_Dance") = #" & Artistic_Fields & "#) "
End If

If IsFields(Artistic_Fields) Then
sql = sql & "AND (rs("Artistic_Field_Music") = #" & Artistic_Fields & "#) "
End If

If IsFields(Artistic_Fields) Then
sql = sql & "AND (rs("Artistic_Field_Theatre") = #" & Artistic_Fields & "#) "
End If

If IsFields(Artistic_Fields) Then
sql = sql & "AND (rs("Artistic_Field_Visual_Arts") = #" & Artistic_Fields & "#) "
End If

If IsFields(Artistic_Fields) Then
sql = sql & "AND (rs("Artistic_Field_Others") = #" & Artistic_Fields & "#) "
End If


<td>
<b>Artistic Field(s): </b>
<select name="Artistic_Fields" size="1" width="60" class="formfield">
<option>- All Fields -</option>
<option value="Film" <% If Artistic_Fields = "Film" Then Response.Write "selected" %>>Film</option>
<option value="Literary Arts" <% If Artistic_Fields = "Literary Arts" Then Response.Write "selected" %>>Literary Arts</option>
<option value="Dance" <% If Artistic_Fields = "Dance" Then Response.Write "selected" %>>Dance</option>
<option value="Music" <% If Artistic_Fields = "Music" Then Response.Write "selected" %>>Music</option>
<option value="Theatre" <% If Artistic_Fields = "Theatre" Then Response.Write "selected" %>>Theatre</option>
<option value="Visual Arts" <% If Artistic_Fields = "Visual Arts" Then Response.Write "selected" %>>Visual Arts</option>
<option value="Others" <% If Artistic_Fields = "Others" Then Response.Write "selected" %>>Others</option>
</select>
</td>

Reply With Quote
  #2  
Old November 25th, 2012, 08:34 PM
gk53 gk53 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 71 gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level)gk53 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 28 m 25 sec
Reputation Power: 8
you are trying just concatinate sql string, rs("Artistic_Field_Film") is value from database, I do not knoe from where you get rs("Artistic_Field_Film"), but if it is database value code

Code:
If IsFields(Artistic_Fields) Then
 sql = sql & "AND (rs("Artistic_Field_Film") = #" & Artistic_Fields & "#) " [highlight]////// The error is show up here end of line before " (double code)
 End If


should be changed to

If IsFields(Artistic_Fields) Then
sql = sql & "AND " & (rs("Artistic_Field_Film") & " = #" & Artistic_Fields & "#) "
End If

Reply With Quote
  #3  
Old November 25th, 2012, 10:49 PM
kyithar kyithar is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 16 kyithar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 26 m 16 sec
Reputation Power: 0
Expected ')' Microsoft VBScript compilation

Hi,

I used the exact same code like you said but

show up the Expected ')' error on the following line.

If IsFields(Artistic_Fields) Then
sql = sql & "AND" &(rs("Artistic_Field_Film")& " = #" Artistic_Fields & "#) " /////Error show up this line before (&)
End If

Please, can anyone suggest more to fix this code.

Thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Microsoft VBScript compilation (0x800A0401) Expected end of statement

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap