Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    124

    Unanswered: syntax expected ')' error

    I get the following error type:

    Microsoft VBScript compilation (0x800A03EE)
    Expected ‘)’
    /supercircuits/results.asp, line 19, column 119

    This is how the advanced recordset dialog box displays in DMX . I took a screen capture. Here is the URL:

    http://www.dwayneepps.com/test/rsimage.asp

    Here is the code from the page as well:

    <%
    Dim Recordset1__MMColParam
    Recordset1__MMColParam = “1”
    If (Request.Form(“txtKeywords”) <> “”) Then
    Recordset1__MMColParam = Request.Form(“txtKeywords”)
    End If
    %>
    <%
    Dim Recordset1
    Dim Recordset1_numRows

    Set Recordset1 = Server.CreateObject(“ADODB.Recordset”)
    Recordset1.ActiveConnection = MM_connRecruit_STRING
    strTest = Request.Form(“selMatchType”)
    Select Case strTest
    Case Exact
    Recordset1.Source = “SELECT * FROM tblProducts WHERE prod_number = ‘” + Replace(Recordset1__MMColParam, “’”, “””) + “’”
    Case Ending
    Recordset1.Source = “SELECT * FROM tblProducts WHERE prod_number Like ‘%” + Replace(Recordset2__MMColParam, “’”, “””) + “’”
    Case Contain
    Recordset1.Source = “SELECT * FROM tblProducts WHERE prod_number Like ‘%” + Replace(Recordset2__MMColParam, “’”, “””) + “%’”
    Case Begin
    Recordset1.Source = “SELECT * FROM tblProducts WHERE prod_number Like ‘” + Replace(Recordset2__MMColParam, “’”, “””) + “%’”
    End Select
    Recordset1.CursorType = 0
    Recordset1.CursorLocation = 2
    Recordset1.LockType = 1
    Recordset1.Open()

    Recordset1_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index

    Repeat1__numRows = -1
    Repeat1__index = 0
    Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
    %>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1”>
    </head>

    <body>
    <%
    While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
    %>
    <table width=”500” border=”0” cellspacing=”0” cellpadding=”0”>
    <tr>
    <td><%=(Recordset1.Fields.Item(“id”).Value)%></td>
    <td><%=(Recordset1.Fields.Item(“prod_number”).Valu e)%></td>
    </tr>
    </table>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    Recordset1.MoveNext()
    Wend
    %>
    </body>
    </html>
    <%
    Recordset1.Close()
    Set Recordset1 = Nothing
    %>


    Can anyone see where the syntax error is? Thanks in advance.
    -Dman100-

  2. #2
    Join Date
    Apr 2004
    Posts
    50
    You have to replace your single quotes ' with 2 single quotes '', not with one double quote "


    Replace(Recordset2__MMColParam, “'”, “''”)

  3. #3
    Join Date
    Jan 2004
    Posts
    124
    Hi Peter,
    Thank you for replying to my post and your help. I replaced the double quotes with two single quotes and that solved the expected statement error, but now I'm getting the following error:

    Command text was not set for the command object.
    /supercircuits/results.asp, line 30

    Here is the revised code:

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/DBConn.asp" -->
    <%
    Dim Recordset1__MMColParam
    Recordset1__MMColParam = "1"
    If (Request.Form("txtKeywords") <> "") Then
    Recordset1__MMColParam = Request.Form("txtKeywords")
    End If
    %>
    <%
    Dim Recordset1
    Dim Recordset1_numRows

    Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    Recordset1.ActiveConnection = MM_DBConn_STRING
    strTest = Request.Form("selMatchType")
    Select Case strTest
    Case Exact
    Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
    Case Ending
    Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
    Case Contain
    Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
    Case Begin
    Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
    End Select
    Recordset1.CursorType = 0
    Recordset1.CursorLocation = 2
    Recordset1.LockType = 1
    Recordset1.Open()

    Recordset1_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index

    Repeat1__numRows = -1
    Repeat1__index = 0
    Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
    %>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <%
    While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
    %>
    <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><%=(Recordset1.Fields.Item("id").Value)%></td>
    <td><%=(Recordset1.Fields.Item("prod_number").Valu e)%></td>
    </tr>
    </table>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    Recordset1.MoveNext()
    Wend
    %>
    </body>
    </html>
    <%
    Recordset1.Close()
    Set Recordset1 = Nothing
    %>

    Thanks again for your help. I appreciate it.
    -Dman100-

  4. #4
    Join Date
    Apr 2004
    Posts
    50

  5. #5
    Join Date
    Jan 2004
    Posts
    124
    Peter,

    I have Recordset1 set, but I didn't understand what you meant by checking if Recordset1.Source was set to one of the four SQL Strings. Can you explain? Do I need to just add set to the beginning of one of the SQL String lines...

    set Recordset1.Source = "SELECT...

    Thanks a bunch!
    -Dman100-

  6. #6
    Join Date
    Jan 2004
    Posts
    124
    Well, I'm not recieving any errors anymore, but no records are displaying from the search. Are the SQL statements wrong?

    Here is the code:

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/DBConn.asp" -->
    <%
    Dim Recordset1__MMColParam
    Recordset1__MMColParam = "1"
    If (Request.Form("txtKeywords") <> "") Then
    Recordset1__MMColParam = Request.Form("txtKeywords")
    End If
    %>
    <%
    Dim Recordset1
    Dim Recordset1_numRows

    Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    Recordset1.ActiveConnection = MM_DBConn_STRING
    strTest = Request.Form("selMatchType")
    Select Case strTest
    Case Exact
    Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
    Case Ending
    Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
    Case Contain
    Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
    Case Begin
    Case Else Recordset1.Source = "SELECT * FROM tblProducts WHERE prod_number = '" + Replace(Recordset1__MMColParam, "'", "''") + "'"
    End Select
    Recordset1.CursorType = 0
    Recordset1.CursorLocation = 2
    Recordset1.LockType = 1
    Recordset1.Open()

    Recordset1_numRows = 0
    %>
    <%
    Dim Repeat1__numRows
    Dim Repeat1__index

    Repeat1__numRows = -1
    Repeat1__index = 0
    Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
    %>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <%
    While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
    %>
    <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><%=(Recordset1.Fields.Item("id").Value)%></td>
    <td><%=(Recordset1.Fields.Item("prod_number").Valu e)%></td>
    </tr>
    </table>
    <%
    Repeat1__index=Repeat1__index+1
    Repeat1__numRows=Repeat1__numRows-1
    Recordset1.MoveNext()
    Wend
    %>
    </body>
    </html>
    <%
    Recordset1.Close()
    Set Recordset1 = Nothing
    %>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •