|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
First of all, my apologies for doing a re-post, but I didn't get a response
from the ODBC section.... So here it is again..... Hello, I am receiving the following error when sending a paramaterized statement from a web page to SQL Server via ODBC connection Msg 8179, Level 16, State 2, Procedure sp_prepexec, Line 1 Could not find prepared statement with handle 1. Here is the captured statements received by SQL server (captured by Profiler): declare @p1 int set @p1=1 exec sp_prepexec @p1 output,N'@P1 nvarchar(5)',N'SELECT userid FROM usertable WHERE username = @P1 ',N'admin' select @p1 The odd thing is, if I copy and paste into Query Anylzer, and comment out line 2 (set @p1=1), it works fine.....uncomment line 2 and I get the same error. Can anyone tell me the cause of this and a possible work around? I don't know how to tell the CGI script on the web page not set a value of @p1 (not sure it is even responsible for doing it). Thanks, Mark |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
> declare @p1 int
> set @p1=1 > exec sp_prepexec @p1 output,N'@P1 nvarchar(5)',N'SELECT userid It looks like it's passing @p1 as an OUTPUT parameter. If it has a value, it might need to be an INOUT parameter instead of an OUTPUT parameter. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
> Can anyone tell me the cause of this and a possible work around? I don't
> know how to tell the CGI script on the web page not set a value of @p1 > (not > sure it is even responsible for doing it). sp_prepexec is an undocumented proc that is part of the client API. This error could be a result of an application error (i.e. calling API methods in the wrong sequence) or an API bug. I don't know anything about CGI but you might try posting the relevant code snippet in case someone can spot something. -- Hope this s. Dan Guzman SQL Server MVP http://weblogs.sqlteam.com/dang/ "Mark" <Mark@discussions.microsoft.com> wrote in message news:1E67FC65-E5E1-42AB-BB10-B0CCB5479CD3@microsoft.com... > First of all, my apologies for doing a re-post, but I didn't get a > response > from the ODBC section.... So here it is again..... > > Hello, > > I am receiving the following error when sending a paramaterized statement > from a web page to SQL Server via ODBC connection > > Msg 8179, Level 16, State 2, Procedure sp_prepexec, Line 1 > Could not find prepared statement with handle 1. > > > Here is the captured statements received by SQL server (captured by > Profiler): > > declare @p1 int > set @p1=1 > exec sp_prepexec @p1 output,N'@P1 nvarchar(5)',N'SELECT userid > FROM usertable > WHERE username = @P1 > ',N'admin' > select @p1 > > The odd thing is, if I copy and paste into Query Anylzer, and comment out > line 2 (set @p1=1), it works fine.....uncomment line 2 and I get the same > error. > > Can anyone tell me the cause of this and a possible work around? I don't > know how to tell the CGI script on the web page not set a value of @p1 > (not > sure it is even responsible for doing it). > > Thanks, > Mark > > > |
|
![]() |
| Outils de la discussion | |
|
|