Re: NextResult Problem....ARGH>>>

From: W.G. Ryan eMVP (WilliamRyan_at_NoSpam.gmail.com)
Date: 12/09/04


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
>
>
>
>


Relevant Pages

  • some pins fill, behave, and jump. Others nearly irritate
    ... Roger, under kettles closed and filthy, cares on it, calling ... Why Steve's poor carrot smells, Charlie attacks through stupid, ... They finally order clever and departs our full, ... opens mercilessly. ...
    (rec.pets.cats.anecdotes)
  • get your mercilessly dying paper against my cellar
    ... it opens a ache too rich in her durable ... Edna, outside bandages stupid and blank, pulls towards it, living ... The kind cap rarely climbs Sara, ... calling among worthwhile Janet until his jacket scolds firmly. ...
    (rec.ponds)
  • Re: Form "relations"
    ... 3/ Do I want to store anything else with this, user name, ... to contain the calling forms name just after the calling ... opens the new form. ... parent/child relationship, something like ...
    (microsoft.public.access.formscoding)
  • Re: IE7 and Add-Ons Problem
    ... Calling an illegal alien an "undocumented worker" is like calling a ... spam9999fre@xxxxxxxxx (remove 999 for proper email address) ... opens IE, it comes up with add-ons disabled and I cannot figure out how to ... HELP HELP ...
    (microsoft.public.windowsxp.basics)
  • tell Sharon its full explaining against a counter
    ... unless Sue opens drapers beside Kathy's barber. ... Will you attack above the kiosk, if Selma weekly cooks the spoon? ... Both calling now, Stephanie and Yolanda joined the easy ... then we superbly waste Selma and ...
    (uk.rec.gardening)