Re: SqlDataReader.Close() bug?
From: Miha Markic [MVP C#] (miha)
Date: 07/30/04
- Next message: Paul Clement: "Re: Build new Access database from .NET application."
- Previous message: Cowboy \(Gregory A. Beamer\) [MVP]: "Re: Where would i get the oracle .net client ?"
- In reply to: William \(Bill\) Vaughn: "Re: SqlDataReader.Close() bug?"
- Next in thread: Pablo Castro [MS]: "Re: SqlDataReader.Close() bug?"
- Reply: Pablo Castro [MS]: "Re: SqlDataReader.Close() bug?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 30 Jul 2004 20:45:29 +0200
Hi Bill,
"William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message
news:eKuZv7ldEHA.3792@TK2MSFTNGP09.phx.gbl...
> This makes sense. You did not cancel the operation. First, you asked for
> 100,000 gallons of water to be pumped into a tank. You opened the spigot
and
> took out a couple of gallons and then said forget it.
>
> The server does not know you don't want the rest of the rows. You need to
> use Command.Cancel first, then close the DataReader. I expect the server
is
> still fetching rows and ADO.NET is flushing them.
I am not sure if this is the case because:
a) it really shouldn't just exit the application
b) this ugly piece of code works just fine (note that there are more than
two records)
sqlConnection1.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM Orders", sqlConnection1);
SqlDataReader rdr = cmd.ExecuteReader();
bool res = rdr.Read();
res = rdr.Read();
rdr.Close();
sqlConnection1.Close();
Well, just my feeling.
-- Miha Markic [MVP C#] - RightHand .NET consulting & development miha at rthand com www.rthand.com
- Next message: Paul Clement: "Re: Build new Access database from .NET application."
- Previous message: Cowboy \(Gregory A. Beamer\) [MVP]: "Re: Where would i get the oracle .net client ?"
- In reply to: William \(Bill\) Vaughn: "Re: SqlDataReader.Close() bug?"
- Next in thread: Pablo Castro [MS]: "Re: SqlDataReader.Close() bug?"
- Reply: Pablo Castro [MS]: "Re: SqlDataReader.Close() bug?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|