Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 4th, 2004, 03:08 PM
Authorized User
 
Join Date: Jun 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax Error

Hi guys,

I got an error message when I was doing a keyword search in my BBS system with the keyword: Open C's. If I only use "Open C" without "'s", it would work.

This is the error message:

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

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 's'.
/forum/forums.asp, line 1661.

The data type of the field is text. Below is the code with line 1661:
----------------------------------------------------------------
if level1_Disc_Topics_sql <> "" then
    cmd.CommandText = level1_Disc_Topics_sql
    rs.Filter = ""
    if ForumId <> "" then rs.Filter = "ForumId = " & to_sql(ForumId,"number")
    rs.CursorLocation = 3
    rs.CacheSize = 5
    rs.Open cmd'Line 1661
        if not rs.EOF then
            rs.MoveFirst
            rs.PageSize = 15
            max_count = cInt(rs.PageCount)
            num_recs = rs.RecordCount
            rs.AbsolutePage = page_no
            results = true
            ':: inherit page params for append on grid links
            for each tmp in request.querystring
                if tmp <> "page_no" AND tmp <> "sortby" then
                request_string = request_string & tmp & "=" & request.querystring(tmp) & "&"
                end if
            next
    else
        results = false
        rs.Close
    end if
else
    results = false
end if
rec_count = 0



 
Old October 4th, 2004, 03:14 PM
Authorized User
 
Join Date: Jun 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I just want to add that whenever I use an apostrophe in the search field, I got a syntax error message.

Cinderella

 
Old October 5th, 2004, 03:17 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey Cinderella,

Have you tried replacing the apostrophes with two apostrophes e.g. "Open C's" to "Open C''s".

HTH,

Chris

 
Old October 5th, 2004, 10:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Cinderella,

As Chris suggested, use Replace function to replace all single quotes with 2 single quotes.
Code:
Replace(the_Value_you_would_pass, "'", "''")
and use that in your search condition.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse error: syntax error, unexpected T_ELSE in /h vipin k varghese BOOK: XSLT Programmer's Reference, 2nd Edition 4 September 29th, 2011 01:19 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
VB Error: Syntax Error or Access Violation codehappy VB How-To 7 October 3rd, 2007 05:41 PM
Compile error: Syntax error: & Else without HELP Corey VB How-To 2 April 21st, 2006 03:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.