Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / May 2006



Tip: Looking for answers? Try searching our database.

ADO RecordSet Object Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dylanfinney@gmail.com - 31 May 2006 15:42 GMT
Hello,

I'm posing to this group because I need some help with an issue I'm
encountering opening an ADO Recordset.

Posted below is the code that I am using to open the Recordset

Set rsReportData = Server.CreateObject("ADODB.RecordSet")
       rsReportData.CursorLocation = adUseClient
       rsReportData.CursorType = adOpenStatic

Set reportObj = Server.CreateObject("ADODB.Command")
With reportObj
       .CommandTimeout = 120
       .ActiveConnection = cnnData
       .CommandType = adCmdStoredProc
       .commandText = "usp_ARSReport_InboundPassangerSummary"
               .Parameters.Append
reportObj.CreateParameter("@StartDate",adDate,adParamInput,,StartDate)

               .Parameters.Append
reportObj.CreateParameter("@EndDate",adDate,adParamInput,,EndDate)

End With

rsReportData.Open reportObj

^^^^^ This is where the problem rears its ugly head.  The stored
procedure always returns records when I run it through query analyzer
however when I try and pass some dates the recordset refuses to open.
The connection is valid, and if I run the stored proc through query
analyzer with the dates causing the error it returns data so I'm not
sure where the problem is comming from.  I also thought that the data
I'm passing through to the param argument was invalid but I tried
sending through as CDate(startdate) & CDate(enddate) and it still
failed.  Perhaps the strangest part about this is that it produces no
error.  ANY help tracking this bug down is greatly appreciated!

Dylan Finney
dylanfinney@gmail.com - 31 May 2006 20:42 GMT
I have cleared up this problem.  Although I had the following in place

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

as well as

SET NOCOUNT ON

in the stored procedure, error messages returned by aggregate or other
SET operations are returned as well as the recordset.  This causes no
ADO errors to be thrown but will not allow the recordset object to be
opened.  I corrected the problem in the stored procedure bu using
IsNull and the Coalesce functions.

Hopefully if anyone else encounters this type of problem these posts
will help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.