Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Error passing variable to Stored Procedure

Author  Topic 

JimAmigo
Posting Yak Master

119 Posts

Posted - 2004-08-25 : 09:49:00
I am passing a variable in an ASP page to a stored procedure. It is a datetime field in the database that I am trying to query to.

I keep getting a syantax error on the asp page:

Microsoft OLE DB Provider for SQL Server error '80040e14'

Line 1: Incorrect syntax near '/'.

/go resource center/intranet II/roster/mgmt/reports/Protocol.asp, line 70


Here is my stored procedure:

CREATE PROCEDURE Protocol
@PassDate datetime
AS
SELECT *

FROM table where table.date > '"& @PassDate &"'
ORDER BY table.name
GO


Here is how I am calling the SP in the ASP page:

<% Dim PassDate
PassDate = request("PassDate")
%>

<% Set mCon2=server.createobject("ADODB.connection")
mCon2.open "Provider=SQLOLEDB; Data Source=GOMODB; Initial Catalog=xxxxxx; User Id=xxxxxx; Password=xxxxxx;"
set orr2 = server.createobject("adodb.recordset")
Stt2 = "Protocol " & PassDate
orr2.Open Stt2, mCon2%>

Any help or sugguestions on correcting this issue would be greatly appreciated.

Thanks!

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-08-25 : 10:02:01
Try this:
Stt2 = "Protocol '" & PassDate & "'"

Duane.
Go to Top of Page

JimAmigo
Posting Yak Master

119 Posts

Posted - 2004-08-25 : 10:49:57
That worked great... I really apprecaite your help..
Go to Top of Page
   

- Advertisement -