If you're looking at the watch you created earlier and see it doing that -
it's normal. When the properties are being checked by the watch you created,
and an exception gets thrown while it's updating the watch it just shows you
there was a problem. Those exceptions won't get thrown within your
application unless you access the dbCon.ServerVersion property after you've
closed the connection in your own code.
"rbDeveloper" <(E-Mail Removed)> wrote in message
news:3E92AA2E-70A0-4175-9C21-(E-Mail Removed)...
> In this question, I'm actually all set with the data. The thing I'm trying
> to
> figure out is what I need to do so that I don't get an exception when I
> call
> dbCon.Close().
>
>
>
> "Ignacio Machin ( .NET/ C# MVP )" wrote:
>
>> On Jun 24, 12:37 pm, rbDeveloper
>> <rbDevelo...@discussions.microsoft.com> wrote:
>> > In the code below, I'm setting a watch on the variable dbCon. When I
>> > expand
>> > the watch on dbCon, one of the visible items under dbCon is
>> > "ServerVersion."
>> >
>> > When the dbCon.Close() executes, I see the following:
>> >
>> > dbCon.ServerVersion threw an expection of type
>> > 'System.InvalidOperationException'
>> >
>> > ...and the details...
>> >
>> > Operation is not valid due to the current state of the object.
>> >
>> > I'd rather not throw exceptions. Any ideas what I need to do before
>> > closing
>> > to avoid all this?
>>
>> You need to copy the value BEFORE closing the connection, if the
>> conenction is close you cannot access it
>>
|