Monday, March 12, 2012

Example code for consuming a SSIS datareader from ASP.net

Hi,
Does anyone have any or know of any demo code that shows how to consume data made available by a SSIS DataReader destination in an ASP.net app.

Thanks in advance.

-Jamie

P.S. Doug if you're reading this, it'd be handy to have some examples such as this in BOL or maybe even something provided with the samples.Re: How do I consume a DataReader Destination in VB.Net? - Microsoft Technical Forums
(http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=64798)

Doug mentions a topic, although I cannot check it right now.|||Cheers Darren.

The link to the article with the code in it is
http://msdn2.microsoft.com/en-us/library/ms215053

-Jamie|||I've struggled with the best description to provide of the issue where you must call DataReader.Read() one last time AFTER the final row of data, to avoid an exception.

Here is the current draft of the text, expanded from the version displayed in the topic that Jamie kind provided the link for:

"The Read method of this implementation of the DataReader returns true one more time after the last row of data has been read. This fact makes it difficult to use the usual code that loops through the DataReader while Read returns true. If your code attempts to close the DataReader or the connection after reading the expected number of rows, without an additional, final call to the Read method, the code will raise an unhandled exception. However if your code attempts to read data on this final iteration through a loop, when Read still returns true but the last row has been passed, the code will raise an unhandled ApplicationException with the message, "The SSIS IDataReader is past the end of the resultset." This behavior is different from that of other DataReader implementations. When using a loop to read through the rows in the DataReader while Read returns true, you need to write code to catch, test, and discard this anticipated ApplicationException on the last successful call to the Read method. Or, if you know in advance the number of rows expected, you can process the rows, then call the Read method one more time before closing the DataReader and the connection."|||Hmm... so much for the MSDN search integrated into BOL. I only have June BOL on hand, and did the online search pick that up, did it hell. Thanks.

No comments:

Post a Comment