ThreadAbortException at System.Data.SqlClient.SqlCommand.ExecuteRe (BIS)

  • Thread starter Thread starter Olivier BESSON
  • Start date Start date
O

Olivier BESSON

Hello,

I resend the same question i previously sent because i did'nt used the good
reply-to address.

I'm having a ThreadAbortException and i don't know why.
When i launch the same code sometimes it never crash a the same place but
always in the proc. you find below.
If it can help, i'm using Nant and i launch the code with "Test with
debugger".
My base code is reading files on disk and making a lot of insert and update
queries on the server. I'm the only user of the database.

This is the code :
Public Shared Function QueryDataSetWithNoExceptionCode(ByVal SQLQuery As
String) As DataSet

Try

Dim sConnectionString As String = _GetConnectionString()
Dim conDB As New SqlConnection(sConnectionString & ";connect
timeout = 60")
Dim cmdQuery As New SqlCommand(SQLQuery, conDB)
cmdQuery.CommandTimeout = 300

Dim da As New SqlDataAdapter(cmdQuery)
Dim ds As New DataSet

da.Fill(ds)

cmdQuery = Nothing
conDB = Nothing
da = Nothing

Return ds

Catch ex As Exception

Throw ex

End Try


End Function


When the breakpoint is on the catch i have this :

?ex.ToString
"System.Threading.ThreadAbortException: Le thread a été abandonné.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior)
at
System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at
Corus.FortisDocumentService.FortisDocumentService.Metier.CorusFortisDataAccess.QueryDataSetWithNoExceptionCode(String
SQLQuery) in
C:\DATAS\Dvpt\Sources\Clients\Fortis\FortisDocumentService\Trunk\src\FortisDocumentService.Metier\CorusFortisDataAccess.vb:line
55"
 
Hi Olivier,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you're getting a ThreadAbortException
when trying to execute a SqlDataAdapter.Fill(). If there is any
misunderstanding, please feel free to let me know.

From the code, we didn't see anything wrong. But could you let me know what
OS are your working on? Here I suggest you try to apply the latest MDAC(2.8
sp1) to your machine. You can download it from the following link and try
to run your code again after installing.

http://www.microsoft.com/downloads/details.aspx?FamilyID=78cac895-efc2-4f8e-
a9e0-3a1afbd5922e&DisplayLang=en

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Kevin,

I'm working on an XP Prod SP 2 so i'm already with MDAC 2.8 SP1.
I think i find something interesting :
I said in my previous post that i used Nant, in fact it's Nunit and i was
runing in debugging mode a very long test with hundreds of thousands DB
statements.
I tried yesterday nigth to run the same test from a winform application and
all things runed ok.
I'm really not a god of threads and i'm just starting with .NET but maybe my
problem came only from Nunit that launch my code within a thread and stop it
after a too long time this thread is running ????
I'll investigate more on this but if you know more about Nunit and a
possible "timeout" of tests please let me know.

Regards,

Olivier
 
Hi Olivier,

Yes, I also think it might be the NUnit problem. Nothing seems to be wrong
with the problem. I have little knowledge on NUnit. Would you try to
increase the value of timeout?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top