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 > syntax expected ')' error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-16-04, 09:36
-Dman100- -Dman100- is offline
Registered User
 
Join Date: Jan 2004
Posts: 124
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-
Reply With Quote
  #2 (permalink)  
Old 07-16-04, 10:23
ASP-Hosting.ca ASP-Hosting.ca is offline
Registered User
 
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, “'”, “''”)
Reply With Quote
  #3 (permalink)  
Old 07-16-04, 21:53
-Dman100- -Dman100- is offline
Registered User
 
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-
Reply With Quote
  #4 (permalink)  
Old 07-16-04, 22:28
ASP-Hosting.ca ASP-Hosting.ca is offline
Registered User
 
Join Date: Apr 2004
Posts: 50
Check if Recordset1.Source is actually set to one of the for SQL strings.
Reply With Quote
  #5 (permalink)  
Old 07-17-04, 01:43
-Dman100- -Dman100- is offline
Registered User
 
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-
Reply With Quote
  #6 (permalink)  
Old 07-17-04, 18:41
-Dman100- -Dman100- is offline
Registered User
 
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
%>
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