Current location: Hot Scripts Forums » Programming Languages » ASP » ASP SQL query string problem


ASP SQL query string problem

Reply
  #1 (permalink)  
Old 10-24-03, 10:02 AM
CollinAmes CollinAmes is offline
New Member
 
Join Date: Oct 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Question ASP SQL query string problem

I have a script on a page that queries our document management system for some documents. The script works fine until I try to use search criteria that uses the traditional reserved words or special characters. Here's the string:


strSQL = "SELECT rev.dDocTitle, rev.dDocType, rev.dRevLabel, rev.dInDate, rev.dSecurityGroup, rev.dDocName, rev.dWebExtension " &_
"FROM DocMeta doc INNER JOIN Revisions rev " &_
"ON doc.dId = rev.dId " &_
"WHERE rev.dDocType = 'News' AND " &_
"rev.dRevLabel = '1' AND " &_
"rev.dStatus = 'Released' AND " &_
"rev.dInDate >= dateadd(day, -25, getDate()) AND " &_
"doc.xSponsorDepartment LIKE 'Technology and Operations' " &_
"ORDER BY rev.dInDate DESC;"

The bold line is the issue. How do I include words like "and" or special characters like "%" within the ASP code?

Thanks!
Reply With Quote
  #2 (permalink)  
Old 10-24-03, 10:41 AM
Stealth Stealth is offline
1337 pr0gr4mm3r
 
Join Date: Jun 2003
Location: Glasgow, Scotland
Posts: 188
Thanks: 0
Thanked 0 Times in 0 Posts
strSQL = "SELECT rev.dDocTitle, rev.dDocType, rev.dRevLabel, rev.dInDate, rev.dSecurityGroup, rev.dDocName, rev.dWebExtension " &_
"FROM DocMeta doc INNER JOIN Revisions rev " &_
"ON doc.dId = rev.dId " &_
"WHERE rev.dDocType = 'News' AND " &_
"rev.dRevLabel = '1' AND " &_
"rev.dStatus = 'Released' AND " &_
"rev.dInDate >= dateadd(day, -25, getDate()) AND " &_
"doc.xSponsorDepartment LIKE '%Technology and Operations%' " &_
"ORDER BY rev.dInDate DESC;"
Reply With Quote
  #3 (permalink)  
Old 10-24-03, 11:09 AM
CollinAmes CollinAmes is offline
New Member
 
Join Date: Oct 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
"doc.xSponsorDepartment = 'Technology and Operations' " &_

Oops...my bad. I had a mixed-up version in the original post. Above is the problem line in the desired format. Incidentally, I did try your version, but the asp page just doesn't like % in that line...or the "and", either.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
union sql msrnivas ASP.NET 1 10-21-03 03:36 PM
Web Project Design Problem Help me out coolvcguy ASP 0 10-16-03 11:46 AM
Make a query that makes a field a link to the entire row mdhall PHP 8 10-09-03 06:18 PM
ASP Calendar..HELP...pls jimthepict ASP 1 07-31-03 05:01 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM


All times are GMT -5. The time now is 03:47 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.