DataReader problem + OutPutParameter

I was faced this problem yesterday. I search on Google Search engine, but found that we cannot get the OutPutParameter before closing the datareader. So if you want to get the output parameter, you have to close the datareader. After closing datareader, you can got the output parameter. But after closing the datareader you cannot retrieve out data. So if you want to resolve this problme, You have to go through the following :

If you output parament name is @IsExist
SET it with your conditions and query in Stored Procedure

SET @IsExist =1

Then Just add the SELECT statement like :

SELECT @IsExist AS IsExist

Now you can get this variable from Coding(C#) as following

IDataReader = db.Execure(dbCommand);
bool blnIsExist = (Boolean)dr[“IsExist”];

Enjoying na:)
Vijay Modi


About Vijay Modi

Having 12+ years of experience in web application development. Expertise in various domains like E-Commerce, E-Learning, Insurance. I have expertise in web application development, window application development, Performance improvement, bug fixing etc. I have worked on various Microsoft technologies including ASP.Net, MVC, WebApi, WCF, Entity Framework, WPF, Window Application Development, AWS, Azure, AngularJS 2.0 / 1.5.2, .NetCore framework, jQuery. I am believing in quality work and achieving deadlines. Also like to work on new technologies and quick learner.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s