Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 August 11th, 2004, 08:44 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default what's wrong with the pageing?

what's wrong with the pageing?

when I click next page it says:

SELECT * FROM bible WHERE


 
Quote:
quote:Microsoft OLE DB Provider for ODBC Driverserror '80040e14'
Quote:

[Microsoft][ODBC Microsoft Access Driver] Syntax error in WHERE clause. /bible7.asp, line 473



 
Old August 11th, 2004, 11:07 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default


  From your select statement it seems you have'nt given any condition in where clause. If not, check your condition.

Fieldname is correct or not, datatype
Otherwise you response.write the sql statement and see how it was formed.



 
Old August 12th, 2004, 10:20 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

yes but aren't the conditions stated in the ifs?

Code:
  SQL = "SELECT * FROM bible WHERE "
    strConn = GetConnectionString()
                    Response.Write request.QueryString("book")
    If   request.QueryString("book")="Book" then

      Sql = Sql & "book LIKE '%" & Keyword & "%'"

      iCounter = iCounter + 1

    end if

    If   request.QueryString("book_spoke")="Book_Spoke" then

      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If

      Sql = Sql & "book_spoke LIKE '%" & Keyword & "%'"

      iCounter = iCounter + 1

    end if

    If   request.QueryString("book_title")="Book_Title" then

      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If

      Sql = Sql & "book_title LIKE '%" & Keyword & "%'"

      iCounter = iCounter + 1

    end if

    If   request.QueryString("chapter")="Chapter" then

      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If

      Sql = Sql & "chapter LIKE '%" & Keyword & "%'"

      iCounter = iCounter + 1

    end if


    If   request.QueryString("chapter_spoke")="Chapter_Spoke" then

      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If

      Sql = Sql & "chapter_spoke LIKE '%" & Keyword & "%'"

      iCounter = iCounter + 1

    end if

    If   request.QueryString("verse")="Verse" then

      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If

      Sql = Sql & "verse LIKE '%" & Keyword & "%'"

      iCounter = iCounter + 1

    end if

    If   request.QueryString("verse_spoke")="Verse_Spoke" then

      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If

      Sql = Sql & "verse_spoke LIKE '%" & Keyword & "%'"

      iCounter = iCounter + 1

    end if

    If   request.QueryString("text_data")="Text" then

      If iCounter > 0 Then
        Sql = Sql & " AND "
      End If

      Sql = Sql & "text_data LIKE '%" & Keyword & "%'"

      iCounter = iCounter + 1

    end if
    If Trim(Request.QueryString("recordType")) <> "" Then


  aRecTypes = Split(Request.QueryString("recordType"), ",")

  If IsArray(aRecTypes) Then 'This is a bit redundant, but it can't hurt
    SQL = SQL & " AND ("



    For iLoopCount = 0 To UBound(aRecTypes)
      If iLoopCount <> 0 Then
        SQL = SQL & " OR "
      End If

      SQL = SQL & " recordType = '" & trim(aRecTypes(iLoopCount)) & "'"
    Next
  End If
  SQL = SQL & ")"
End If
 
Old August 12th, 2004, 07:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Yes in theory, but that error would mean that none of your ifs are being hit. Try adding the where to each of these clauses, or have a separate where SQL variable and if it isn't empty, append it to the SQL variable.

Brian
 
Old August 12th, 2004, 08:22 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

  May be none of your IF conditions are being satisfied as the earlier post said. You try response.write sql statement before executing and see how it was formed.








Similar Threads
Thread Thread Starter Forum Replies Last Post
searching for pageing recordsets gilgalbiblewheel Classic ASP Databases 18 August 27th, 2006 01:24 AM
Something Wrong TiDeMaN Beginning PHP 1 November 16th, 2005 06:45 AM
Don't know where have gone wrong hoailing22 ASP.NET 1.0 and 1.1 Basics 1 May 20th, 2005 07:06 AM
Where am I going wrong ? fredb23 Classic ASP Databases 3 August 10th, 2004 04:56 AM
Right or wrong? ÕÅÃÍ C++ Programming 6 February 27th, 2004 02:27 AM





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