Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 857
  • Last Modified:

Sql Exception using ADODB.Recordset with cursor parameters

Found sql exception errors as follows:

Error: 156, Severity: 15, State: 1
Error: 16937, Severity: 16, State: 1
Error: 16945, Severity: 16, State: 2

The asp code is as follows:

rs = server.createobject("ADODB.Recordset")
rs.open sql, connectionstring, adOpenstatic, adLockReadOnly, adCmdUnknown

The actual call in the sql trace looks like this.

declare @p1 int
set @p1=0
declare @p3 int
set @p3=557064
declare @p4 int
set @p4=98305
declare @p5 int
set @p1=0
exec sp_cursoropen @p1 output, N'exec sql',@p3 output,@p4 output,@p5 output
select @p1, @p3, @p4, @p5

Not sure if these exceptions are real or not since it does appear to return data.  If I remove the parameters off the rs.open and just have the sql command it does not error.  I have tried setting the parameters in different ways but it does not appear to make a difference.
0
ws11
Asked:
ws11
  • 3
  • 3
1 Solution
 
plummetCommented:
Hi,

Are you setting the value of the parameters somewhere? ie

Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adCmdUnknown = 8

The default is adCmdUnknown anyway so there's no need to specify.

0
 
ws11Author Commented:
yes I have tried to hardcode them in and it does not matter

I think it is something to do with sp_cursoropen.  I am not sure that is even valid in 2008.
0
 
plummetCommented:
What's the SQL you're sending?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
ws11Author Commented:
it is usally a stored procedure
0
 
plummetCommented:
I'd usually open this sort of recordset forward only, which is readonly by its nature. And the fastest way to open a recordset:

Const adOpenForwardOnly = 0

rs.open sql, connectionstring, adOpenForwardOnly


0
 
ws11Author Commented:
Yes that did eliminate the sp_cursoropen.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now