Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

ASP and ADO

I think you might want to ask this in web.asp instead of web.asp.plus (since
it does not really seem to have anything to do with ASP+).

--
MichKa

random junk of dubious value at the multilingual
http://www.trigeminal.com/ and a new book on
i18N in VB at http://www.trigeminal.com/michka.asp

"Shefali Sinha" <shefali_sinha@hotmail.com> wrote in message
news:39958e43$1@news.dev-archive.com...
>
> Hi,
>
> I have a stored proc:
>
> -----------
> CREATE procedure sp_SearchCatalogForFeaturedProducts
> @Dept_Description char(255)
> as
> declare @sql varchar(3000)
>
> select @sql = 'select * from tblCatalog where contains(dept_description,
> ' + "'" + '"' + @Dept_Description + '"' + "')" + 'and (len(image) > 0)'
> execute(@sql)
> -------------
>
>
> I get a syntax error when the value of dept_description is set to:
> 0apparel___jewelry|1children''s_apparel
>
> When I pass this value from the command line, its runs correctly.
> When I pass this from the following code in ASP, I get a syntax error. The
> ASP code is:
> -----------
> Set rs = Server.CreateObject("ADODB.Recordset")
> rs.MaxRecords = 100
> sql = "exec sp_SearchCatalogForFeaturedProducts '" &
escapeSingleQuote(dept_description)
> & "'"
> 'escapeSingleQuote is a function that replace all single quotes 'with 2
single
> quotes
> Call rs.Open(sql, "DSN=" & Application("DSN") & ";uid=" &
Application("UID")
> & ";pwd=" & Application("PWD"))
> ------------
>
> The error I get is:
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
> [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax
near
> 's_apparel'/
> development/myfile.asp line 606
>
> Thanks in advance for any help.
> -Shefali
> (shefali_sinha@hotmail.com)
>
>
[2214 byte] By [Michael \-michka\ Kaplan] at [2007-11-9 16:23:42]
# 1 Re: ASP and ADO
Shefali: Since your question is about ASP, rather than ASP+ (the subject of
this newsgroup), I have moved it to the web.asp group. Thanks!
--
Phil Weber
dev-archive Newsgroup Admin
Phil Weber at 2007-11-11 23:26:29 >