Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
SqlDataReader showing Empty columns until after error.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="lithoman, post: 1984473"] The specific error I mentioned is "Specified cast is not valid." which is thrown by the line return (int)reader[columnName]; (in the GetInt() function) because it is trying to cast an Empty sql column as an int. I uderstand the error, and I can certainly fix that by checking for Empty. What I am concerned with, however, is why is the data not there? The Stored Procedure is returning one row with data. I have confirmed that. The code isn't seeing that row at first, however. When I am debugging, after reader.Read() all the columns are Empty, any one of which causes an error condition. As soon as processing passes to the catch() statement, the reader's columns are no longer empty, but show exactly the data I am expecting. What is causing reader to return empty after the Read() statement, but show me the data after an error is thrown? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
SqlDataReader showing Empty columns until after error.
Top