If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Why does the SQL show error?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-14-04, 15:08
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
Why does the SQL show error?

The error says:
Quote:
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

/wheelofgod/kjvresp2.asp, line 87
Line 87 is:
Code:
rs.Open SQL, conn, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
found in:
Code:
<% 'Option Explicit%>
<!--#include file="biblepagetop.txt"-->
<%
'Response.Buffer=false

' Mode contstants
Const MODE_DEFAULT  = 1
Const MODE_RESULTS  = 2

Const DB_NAME           = "kjv.mdb" ' Name of our database file
Const SCRIPT_NAME       = "kjv2.asp"  ' Name of this script
Const SCRIPT_NAMES      = "kjvresp2.asp"
const SCRIPT_SAVED      = "saved.asp"
Const SCRIPT_FEEDBACK   = "mailto.asp"
Const SCRIPT_TEXT       = "bibletext.asp"

Const RECORDS_PER_PAGE  = 5            ' Number of records per page

Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adCmdTableDirect = &H0200
Const adUseClient = 3

Dim nMode   ' Current Mode 
' Find out what mode we are in
nMode = CLng(Request.QueryString("Mode"))

' Depending on our mode we will do different things
Select Case nMode
    
    Case MODE_RESULTS
        ' This is where all the results will show       
        call ShowResults()

    Case Else   ' This one is for MODE_DEFAULT or invalid modes all the same
        ' By default display the search form
        call ShowSearchForm()
End Select

Private Function GetConnectionString()
    GetConnectionString =   "Driver={Microsoft Access Driver (*.mdb)};" & _
                "DBQ=" & Server.MapPath(DB_NAME) & ";" & _
                "UID=;PWD=;"
End Function

Private Sub ShowSearchForm()
    %>
    <!--
        This form will direct user to itself with MODE_RESULTS mode
    -->
    <%
' This function will display the results of the search
 call ShowResults()
End Sub
%>

<!--#include file="query.asp"-->
<table border="1" cellspacing="0" cellpadding="0" width="732" style="width:549.0pt;
 border-collapse:collapse;border:none;mso-border-alt:solid windowtext .5pt;
 mso-padding-alt:0in 0in 0in 0in">
 <tr style="height:12.75pt">
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">
 <form align="center" method="get" action="<%=SCRIPT_SAVED%>" id=form1 name=form1>Select</font><br>
 <select size="1" name="choices" id="choices">
        <option SELECTED VALUE="">None</option> 
        <option VALUE="001">Delete</option>
        <option VALUE="002">Email to:</option>
        <option VALUE="003">Print</option>
        <option VALUE="004">Save in:</option>
 </select><input type="submit" value="OK" name=submit1><br>
<input type='checkbox' onclick='checkAll(this.form,this)' value="check all" name="ck<%CStr(id)%>">
 <font face="Verdana" color="#FFFFFF">Select All</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Book Title</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Book #/<br>Book Spoke</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Chapter #/<br>Chapter Spoke</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Verse #/<br>Verse Spoke</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Text</font></th>
  </tr>

<%
    Set rs = Server.CreateObject("ADODB.Recordset")
    
    rs.PageSize = 5
    rs.CacheSize = 5
    rs.CursorLocation = adUseClient
    
    <b>rs.Open SQL, conn, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect</b>
    

    If Len(Request("pagenum")) = 0  Then
        rs.AbsolutePage = 1
      Else
        If CInt(Request("pagenum")) <= rs.PageCount Then
            rs.AbsolutePage = Request("pagenum")
          Else
            rs.AbsolutePage = 1
        End If
    End If
    
    Dim abspage, pagecnt
      abspage = rs.AbsolutePage
      pagecnt = rs.PageCount
    If rs.EOF Then
      Response.Write "No records found!"
    Else
      Response.Write "PageCount : " & rs.PageCount & "<br>" & vbcrlf
      Response.Write "Absolute Page : " & rs.AbsolutePage & "<br>" & vbcrlf
      
        Response.Write "Total number of records : " & rs.RecordCount & "<br><br>" & vbcrlf
        
        Dim fldF
        
        Response.Write "<table border=1 align=center cellpadding=3 cellspacing=0><thead><tr>"
        'For Each fldF in rs.Fields
        '  Response.Write "<td>" & fldF.Name & "</td>"
        'Next
        'Response.Write "</tr></thead><tbody>"
        
        For intRec=1 To rs.PageSize
          If Not rs.EOF Then
          '  Response.Write "<tr>"
          '  For Each fldF in rs.Fields
          '    Response.Write "<td>" & fldF.Value & "</td>"
          '  Next
          '  Response.Write "<tr>"

  rs.MoveFirst
  Count = 0 
  Do while not rs.eof And Count < 10 
%>
<%=SQL%>
<td width="135" nowrap rowspan="2" style="width:101.25pt;border:solid windowtext .5pt;
  border-right:solid windowtext .75pt;padding:.75pt .75pt 0in .75pt;height:
  8.0pt">

        <!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.txt"
        S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
        <p><input type="checkbox" name="ck<%CStr(id)%> value="<%=rs("id")%>"></p>

      <p>&nbsp;
    </td>
    <td width="135" nowrap rowspan="2" style="width:101.25pt;border:solid windowtext .5pt;
  border-right:solid windowtext .75pt;padding:.75pt .75pt 0in .75pt;height:
  8.0pt">
      <p class="MsoNormal" align="center" style="text-align:center"><span style="font-size:10.0pt;font-family:Verdana"><%=rs("book_title")%><o:p>
      </span>
      <td width="149" nowrap style="width:111.75pt;border-top:solid windowtext .5pt;
  border-left:none;border-bottom:solid windowtext .75pt;border-right:solid windowtext .75pt;
  mso-border-left-alt:solid windowtext .75pt;padding:.75pt .75pt 0in .75pt;
  height:8.0pt">
      <p class="MsoNormal" align="center" style="text-align:center"><span style="font-size:10.0pt;font-family:Verdana"><%=rs("book")%><o:p>
      </o:p>
      </span></p>
    </td>
    <td width="164" nowrap style="width:123.0pt;border-top:solid windowtext .5pt;
  border-left:none;border-bottom:solid windowtext .75pt;border-right:solid windowtext .75pt;
  mso-border-left-alt:solid windowtext .75pt;padding:.75pt .75pt 0in .75pt;
  height:8.0pt">
      <p class="MsoNormal" align="center" style="text-align:center"><span style="font-size:10.0pt;font-family:Verdana"><%=rs("chapter")%><o:p>
      </o:p>
      </span></p>
    </td>
       <td width="151" nowrap style="width:113.25pt;border-top:solid windowtext .5pt;
  border-left:none;border-bottom:solid windowtext .75pt;border-right:solid windowtext .75pt;
  mso-border-left-alt:solid windowtext .75pt;padding:.75pt .75pt 0in .75pt;
  height:8.0pt">
      <p class="MsoNormal" align="center" style="text-align:center"><span style="font-size:10.0pt;font-family:Verdana"><%=rs("verse")%><o:p>
      </o:p>
      </span></p>
    </td>
    <td width="245" nowrap rowspan="2" valign="top" style="mso-border-left-alt: solid windowtext .75pt; height: 12.75pt; border-left-style: none; border-left-width: medium; border-right: .5pt solid windowtext; border-top: .5pt solid windowtext; border-bottom: .5pt solid windowtext; padding-left: .75pt; padding-right: .75pt; padding-top: .75pt; padding-bottom: 0in">
      <p class="MsoNormal"><span style="font-size:10.0pt;font-family:Verdana"><b><%=rs("book_title")%>&nbsp;&nbsp;<%=rs("chap")%>:<%=rs("vers")%></b><br><%=rs("text_data")%><o:p>
      </o:p>
      </span></p>
    </td>
  <tr style="height:8.0pt" ALIGN="middle">
      <td width="10">
      <span>
<A href="<!--#include file="letters.asp"-->" target="_blank">
<IMG SRC="hebrew/<%=RS("book_spoke")%>.jpg" ALT="Book&nbsp;Spoke&nbsp;&nbsp;<%=RS("book_spoke")%>">
</A> 

</span>
    </td>
    <td width="10">
      <span>
<IMG SRC="hebrew/<%=RS("chapter_spoke")%>.jpg" ALIGN="middle" ALT="Chapter&nbsp;Spoke&nbsp;&nbsp;<%=RS("chapter_spoke")%>">
     
</span>
    </td>
    <td width="10" ALIGN="middle" >
      <span><IMG SRC="hebrew/<%=RS("verse_spoke")%>.jpg" ALIGN="middle" ALT="Verse&nbsp;Spoke&nbsp;&nbsp;<%=RS("verse_spoke")%>">
      </span>
    </td>
  </tr>
<% rs.MoveNext
    Loop
%>
</form>
</table>
<%
            'rs.MoveNext
          End If
        Next
        'Response.Write "</tbody></table><p>"
        
        ' Now showing first, next, back, last buttons.
        Response.Write "<div align=""center"">" & vbcrlf
        Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=1"">First Page</a>"
        Response.Write "&nbsp;|&nbsp;"
        
        If abspage = 1 Then
        Response.Write "<span style=""color:silver;"">Previous Page</span>"
        Else
        Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & abspage - 1 & """>Previous Page</a>"
        End If
                Response.Write "&nbsp;|&nbsp;"
        
        If abspage < pagecnt Then
        Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & abspage + 1 & """>Next Page</a>"
        Else
        Response.Write "<span style=""color:silver;"">Next Page</span>"
        End If
        Response.Write "&nbsp;|&nbsp;"
        Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & pagecnt & """>Last Page</a>"
        Response.Write "</div>" & vbcrlf
        
    rs.Close
    Set rs = Nothing
End If
End Sub
%>
<!--#include file=biblepagebottom.txt-->
I tried shortening the length of the code by putting the SQL statement as an Include File:

<!--#include file="query.asp"-->
Reply With Quote
  #2 (permalink)  
Old 10-14-04, 15:15
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
SQL statement

The code of <!--#include file="query.asp"--> is:
Code:
<%Sub ShowResults()
    Dim conn
    Dim SQL         ' String that will have our SQL statments
    Dim RS          ' Recordset object
    Dim Keyword     ' Keyword for search
'pageing
    Dim nRecCount   ' Number of records found
    Dim nPageCount  ' Number of pages of records we have
    Dim nPage       ' Current page number
'query
    Dim iCounter
    Dim iLoopCount
    Dim aRecTypes
    Dim spoke       ' For dropdown
    Dim number
    Dim Keywordb
    Dim Keywordc
    Dim intRec


    ' define our SQL statement
    ' we will be looking for all the records in tblItem table 
    ' where ItemName contains our Keyword
    ' do not forget to fix tick marks (single quotes) in our Keyword
    SQL = "SELECT * FROM bible WHERE "
    Conn = GetConnectionString()

    Keyword = Trim(Request.QueryString("Keyword"))
    spoke = Request.Querystring("spoke")
    number = Request.QueryString("number")
    Keywordb = Request.QueryString("Keywordb")
    Keywordc = Request.QueryString("Keywordc")

Counter = 0

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

  SQL = SQL & "text_data LIKE '%" & Keyword & "%' AND "  
  SQL = SQL & "text_data LIKE '%" & Keywordb & "%' AND "
  SQL = SQL & "text_data LIKE '%" & Keywordc & "%'"

  iCounter = iCounter + 1

end if


If   request.QueryString("book")="yes" then

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

  SQL = SQL & "book LIKE '" & number & "'"

  iCounter = iCounter + 1

end if


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

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

  SQL = SQL & "book_title LIKE '%" & number & "%'"

  iCounter = iCounter + 1

end if

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

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

  SQL = SQL & "chapter LIKE '%" & number & "%'"

  iCounter = iCounter + 1

end if

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

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

  SQL = SQL & "verse LIKE '%" & number & "%'"

  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 = '" & spoke & "'"

  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 = '" & spoke & "'"

  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 = '" & spoke & "'"

  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%>
I hope you have the patience to read it through or show me if there is any way to simplify it further.

Is it a good idea to leave the SQL as a separate file?
Reply With Quote
  #3 (permalink)  
Old 10-14-04, 21:36
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
okie, I've read though most of this... but can you make it a little easier one us and get the page to write out the sql that it is trying to execute against the database rather then us trying to look for a hole in the building of the sql string?
Reply With Quote
  #4 (permalink)  
Old 10-14-04, 22:42
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
Sql

Quote:
SELECT * FROM bible WHERE text_data LIKE '%artaxerxes%' AND text_data LIKE '%%' AND text_data LIKE '%%'
I don't see anything wrong with it. I have 3 textboxes which may or may not be filled.
Reply With Quote
  #5 (permalink)  
Old 10-14-04, 22:48
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
Sql

Quote:
SELECT * FROM bible WHERE text_data LIKE '%artaxerxes%' AND text_data LIKE '%%' AND text_data LIKE '%%'
I don't see anything wrong with it. I have 3 textboxes which may or may not be filled.
Reply With Quote
  #6 (permalink)  
Old 10-14-04, 22:56
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
Sql

Quote:
SELECT * FROM bible WHERE text_data LIKE '%artaxerxes%' AND text_data LIKE '%%' AND text_data LIKE '%%'
I don't see anything wrong with it. I have 3 textboxes which may or may not be filled.
Reply With Quote
  #7 (permalink)  
Old 10-15-04, 00:19
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
To be honest I can't really see anything wrong with it either unless it is getting upset about the '%%' values.....
Reply With Quote
  #8 (permalink)  
Old 10-15-04, 17:06
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
I wonder if the BOF and EOF along with the while are written correctly. Can you explain the procedure?
Once pasted the query back in the page (instead of file-including) it worked
Reply With Quote
  #9 (permalink)  
Old 10-15-04, 19:09
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
ok

I changed the coding but same error came:
Code:
<% 'Option Explicit
Response.Buffer=false%>
<!--#include file="biblepagetop.txt"-->
<%
' Mode contstants
Const MODE_DEFAULT  = 1
Const MODE_RESULTS  = 2

Const DB_NAME           = "kjv.mdb" ' Name of our database file
Const SCRIPT_NAME       = "kjv2.asp"  ' Name of this script
Const SCRIPT_NAMES      = "kjvresp2.asp"
const SCRIPT_SAVED      = "saved.asp"
Const SCRIPT_FEEDBACK   = "mailto.asp"
Const SCRIPT_TEXT       = "bibletext.asp"

Const RECORDS_PER_PAGE  = 5            ' Number of records per page

Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adCmdTableDirect = &H0200
Const adUseClient = 3

Dim nMode   ' Current Mode 
' Find out what mode we are in
nMode = CLng(Request.QueryString("Mode"))

' Depending on our mode we will do different things
Select Case nMode
    
    Case MODE_RESULTS
        ' This is where all the results will show       
        call ShowResults()

    Case Else   ' This one is for MODE_DEFAULT or invalid modes all the same
        ' By default display the search form
        call ShowSearchForm()
End Select

Private Function GetConnectionString()
    GetConnectionString =   "Driver={Microsoft Access Driver (*.mdb)};" & _
                "DBQ=" & Server.MapPath(DB_NAME) & ";" & _
                "UID=;PWD=;"
End Function

Private Sub ShowSearchForm()
    %>
    <!--
        This form will direct user to itself with MODE_RESULTS mode
    -->
    <%
' This function will display the results of the search
 call ShowResults()
End Sub

Sub ShowResults()
    Dim strConn     ' Database connection string
    Dim SQL         ' String that will have our SQL statments
    Dim RS          ' Recordset object
    Dim Keyword     ' Keyword for search
'pageing
    Dim nRecCount   ' Number of records found
    Dim nPageCount  ' Number of pages of records we have
    Dim nPage       ' Current page number
'query
    Dim iCounter
    Dim iLoopCount
    Dim aRecTypes
    Dim spoke       ' For dropdown
    Dim number
    Dim Keywordb
    Dim Keywordc
    Dim intRec


    ' define our SQL statement
    ' we will be looking for all the records in tblItem table 
    ' where ItemName contains our Keyword
    ' do not forget to fix tick marks (single quotes) in our Keyword
    SQL = "SELECT * FROM bible WHERE "
    strConn = GetConnectionString()

    ' Let's see what page are we looking at right now
    nPage = CLng(Request.QueryString("Page"))

    ' Let's see what user wants to search for today :)
    Keyword = Trim(Request.QueryString("Keyword"))
    spoke = Request.Querystring("spoke")
    number = Request.QueryString("number")
    Keywordb = Request.QueryString("Keywordb")
    Keywordc = Request.QueryString("Keywordc")

'Set conn = Server.CreateObject("ADODB.Connection")  
'conn.Open(GetConnectionString)              

iCounter = 0

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

  SQL = SQL & "text_data LIKE '%" & Keyword & "%' AND "  
  SQL = SQL & "text_data LIKE '%" & Keywordb & "%' AND "
  SQL = SQL & "text_data LIKE '%" & Keywordc & "%'"

  iCounter = iCounter + 1

end if


If   request.QueryString("book")="yes" then

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

  SQL = SQL & "book LIKE '" & number & "'"

  iCounter = iCounter + 1

end if


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

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

  SQL = SQL & "book_title LIKE '%" & number & "%'"

  iCounter = iCounter + 1

end if

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

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

  SQL = SQL & "chapter LIKE '%" & number & "%'"

  iCounter = iCounter + 1

end if

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

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

  SQL = SQL & "verse LIKE '%" & number & "%'"

  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 = '" & spoke & "'"

  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 = '" & spoke & "'"

  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 = '" & spoke & "'"

  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

    Set rs = Server.CreateObject("ADODB.Recordset")
    
    rs.PageSize = 5
    rs.CacheSize = 5
    rs.CursorLocation = adUseClient
    Response.Write SQL
    rs.Open SQL, StrConn, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
    

    If Len(Request("pagenum")) = 0  Then
        rs.AbsolutePage = 1
      Else
        If CInt(Request("pagenum")) <= rs.PageCount Then
            rs.AbsolutePage = Request("pagenum")
          Else
            rs.AbsolutePage = 1
        End If
    End If
    
    Dim abspage, pagecnt
      abspage = rs.AbsolutePage
      pagecnt = rs.PageCount

    If rs.BOF and rs.EOF Then
      Response.Write "No records found!"
    Else
      Response.Write "PageCount : " & rs.PageCount & "<br>" & vbcrlf
      Response.Write "Absolute Page : " & rs.AbsolutePage & "<br>" & vbcrlf
      Response.Write "Total number of records : " & rs.RecordCount & "<br><br>" & vbcrlf
%>
<table>
 <tr>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">
 <form align="center" method="get" action="<%=SCRIPT_SAVED%>" id=form1 name=form1>Select</font><br>
 <select size="1" name="choices" id="choices">
        <option SELECTED VALUE="">None</option> 
        <option VALUE="001">Delete</option>
        <option VALUE="002">Email to:</option>
        <option VALUE="003">Print</option>
        <option VALUE="004">Save in:</option>
 </select><input type="submit" value="OK" name=submit1><br>
<input type='checkbox' onclick='checkAll(this.form,this)' value="check all" name="ck<%CStr(id)%>">
 <font face="Verdana" color="#FFFFFF">Select All</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Book Title</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Book #/<br>Book Spoke</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Chapter #/<br>Chapter Spoke</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Verse #/<br>Verse Spoke</font></th>
 <th bgcolor="#800000"><font face="Verdana" color="#FFFFFF">Text</font></th>
  </tr>
<%
  rs.MoveFirst
  Count = 0 
  Do while not rs.eof And Count < 10 
%>
<td>

        <p><input type="checkbox" name="ck<%CStr(id)%> value="<%=rs("id")%>"></p>

      <p> 
    </td>
    <td>
      <p><span><%=rs("book_title")%><o:p>
      </span>
      <td>
      <p><span><%=rs("book")%><o:p>
      </o:p>
      </span></p>
    </td>
    <td>
      <p><span><%=rs("chapter")%><o:p>
      </o:p>
      </span></p>
    </td>
       <td>
      <p><span><%=rs("verse")%><o:p>
      </o:p>
      </span></p>
    </td>
    <td>
      <p><span><b><%=rs("book_title")%>  <%=rs("chap")%>:<%=rs("vers")%></b><br><%=rs("text_data")%><o:p>
      </o:p>
      </span></p>
    </td>
  <tr>
      <td width="10">
      <span>
<A href="<!--#include file="letters.asp"-->" target="_blank">
<IMG SRC="hebrew/<%=RS("book_spoke")%>.jpg" ALT="Book Spoke  <%=RS("book_spoke")%>">
</A> 
</span>
    </td>
    <td>
      <span>
<IMG SRC="hebrew/<%=RS("chapter_spoke")%>.jpg" ALIGN="middle" ALT="Chapter Spoke  <%=RS("chapter_spoke")%>">
     
</span>
    </td>
    <td>
      <span><IMG SRC="hebrew/<%=RS("verse_spoke")%>.jpg" ALIGN="middle" ALT="Verse Spoke  <%=RS("verse_spoke")%>">
      </span>
    </td>
  </tr>
<% rs.MoveNext
    Loop
%>
</form>
</table>
<%
        ' Now showing first, next, back, last buttons.
        Response.Write "<div align=""center"">" & vbcrlf
        Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAMES") & "?pagenum=1"">First Page</a>"
        Response.Write " | "
        
        If abspage = 1 Then
        Response.Write "<span style=""color:silver;"">Previous Page</span>"
        Else
        Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAMES") & "?pagenum=" & abspage - 1 & """>Previous Page</a>"
        End If
                Response.Write " | "
        
        If abspage < pagecnt Then
        Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAMES") & "?pagenum=" & abspage + 1 & """>Next Page</a>"
        Else
        Response.Write "<span style=""color:silver;"">Next Page</span>"
        End If
        Response.Write " | "
        Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAMES") & "?pagenum=" & pagecnt & """>Last Page</a>"
        Response.Write "</div>" & vbcrlf
%>
<!--#include file=biblepagebottom.txt-->
<%        
    rs.Close
    Set rs = Nothing
End If
End Sub
%>
Quote:
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.

/wheelofgod/kjvresp2.asp, line 218
Reply With Quote
  #10 (permalink)  
Old 10-15-04, 19:13
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
The reason why this might've occured is probably because I used:
http://www.stardeveloper.com/article...0071001&page=1
Because I liked the "pageing". But I don't understand why it shouldn't work!
Reply With Quote
  #11 (permalink)  
Old 10-16-04, 20:19
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
I suggest you change this
Code:
If   request.QueryString("text_data")="yes" then

  SQL = SQL & "text_data LIKE '%" & Keyword & "%' AND "  
  SQL = SQL & "text_data LIKE '%" & Keywordb & "%' AND "
  SQL = SQL & "text_data LIKE '%" & Keywordc & "%'"

  iCounter = iCounter + 1

end if
to this...
Code:
If   request.QueryString("text_data")="yes" then

  if Keyword <> "" then 
    SQL = SQL & "text_data LIKE '%" & Keyword & "%' AND "  
  end if

  if Keywordb <> "" then 
    SQL = SQL & "text_data LIKE '%" & Keywordb & "%' AND "
  end if

  if Keywordc <> "" then 
    SQL = SQL & "text_data LIKE '%" & Keywordc & "%'"
  end if

  iCounter = iCounter + 1

end if
and see if your problem goes away
Reply With Quote
  #12 (permalink)  
Old 10-16-04, 21:32
gilgalbiblewhee gilgalbiblewhee is offline
Registered User
 
Join Date: Jul 2004
Posts: 494
ok

I had tried it by removing all the possible extensions and leave SQL="SELECT * FROM bible " and it still didn't work.
Reply With Quote
  #13 (permalink)  
Old 10-17-04, 19:11
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
in that case I would suggest that your sql string is not what you think it is.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On