Re: NextResult Problem....ARGH>>>
From: W.G. Ryan eMVP (WilliamRyan_at_NoSpam.gmail.com)
Date: 12/09/04
- Next message: Chris: "Is this possible"
- Previous message: Elton Wang: "re:XPath problems..."
- In reply to: mdjhome: "NextResult Problem....ARGH>>>"
- Next in thread: mdjhome: "Re: NextResult Problem....ARGH>>>"
- Reply: mdjhome: "Re: NextResult Problem....ARGH>>>"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 8 Dec 2004 19:24:43 -0500
Is there a DataReader open somewhere else on a different thread? Are you
getting this when calling Fill?
--Why leave anything to chance? You don't by letting the adapter take care
of it for you. You are using a Finally block and that's what matter
(although I'd test != ConnnectionState.Closed for future compatibility
issues) but you are adding unncessary code.
Where is the 41 visible? Are you iterating through the table somehwere?
-- W.G. Ryan MVP (Windows Embedded) TiBA Solutions www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com "mdjhome" <mdjhome@nospam.nospam> wrote in message news:827DC7DC-2594-477C-8077-702E90809B13@microsoft.com... > Greetings, > > I have an issue that I just can seem to get past today. I continually get > the following error: > > Invalid attempt to NextResult when reader is closed > > This is happening when calling this code, which is our standard block around > a simple fill function: > > If cnx.State = ConnectionState.Open Then > cnx.Close() > End If > cnx.Open() > Try > adapterTimeRecords.Fill(DstTimeRecords.app__TimeRecords) > Catch ex As SqlClient.SqlException > MSCError.MSCErrorSQL(ex) > Catch es As SystemException > MSCError.MSCErrorSystem(es) > Catch ea As Exception > MSCError.MSCError(ea) > Finally > If cnx.State = ConnectionState.Open Then > cnx.Close() > End If > End Try > > The select command is a simple SQL Statement where the following is the text > of that: > > SELECT DISTINCT IDCODE_PERSNNEL, SSN, firstname, lastname, sortpjc FROM > app__TimeRecords where idcode_persnnel in (SELECT idcode_persnnel FROM > app__TimeRecords where idcode_ship = 3 AND PayPeriodID = 1 ) ORDER BY > SortPJC, ssn" > > Notes: > > - The standard code block ensures that the connection is open prior to the > calling of the fill statement (yes, I know that calling fill also opens the > connection automatically, but why leave anything to chance?) > > - If I step through this code, when the adapter is in scope, the debug > window does not throw this error but rather gives me '41' which is correct > and what it should be, having tested this in SQL Profiler. > > - when it throws the exception, it does not throw it via the > SQLClient.SQLConnection class, but rather the System.Exception class. > > This is really stupid weird, as I have this same fill statement used > elsewhere and it always runs fine. > > Michael > > > >
- Next message: Chris: "Is this possible"
- Previous message: Elton Wang: "re:XPath problems..."
- In reply to: mdjhome: "NextResult Problem....ARGH>>>"
- Next in thread: mdjhome: "Re: NextResult Problem....ARGH>>>"
- Reply: mdjhome: "Re: NextResult Problem....ARGH>>>"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|