Re: "Thread was being stopped" while trying to connect to AS400 iSeries using .NET by Daniel
Daniel
Mon Aug 28 10:45:14 CDT 2006
Here's a really simple set of code to duplicate the problem. This is a C++
.NET console app.
using namespace IBM::Data::DB2::iSeries;
int _tmain()
{
Console::WriteLine(S"Hello World");
try{
IBM::Data::DB2::iSeries::iDB2Connection *SourceConn = new
IBM::Data::DB2::iSeries::iDB2Connection(
S"DataSource=MyISeries;DefaultCollection=MyCollection;UserID=Me;Password=MyP
assword;");
}catch (System::Threading::ThreadStateException* Tex){
Console::WriteLine(S"ThreadStateException: {0}",Tex->Message);
}catch (Exception *Ex){
Console::WriteLine(S"Some other exception: {1} with message: {0}",
Ex->Message, Ex->GetType());
}
Console::WriteLine(S"Goodbye World");
return 0;
}
Output is:
Hello World
Some other exception: System.Threading.ThreadStopException with message:
Thread
was being stopped.
Goodbye World
Ideas, anyone?
Thanks.
dwilson
"Daniel Wilson" <d.wilson@EmbTrak.com> wrote in message
news:O5vmsMHyGHA.1300@TK2MSFTNGP05.phx.gbl...
> My codes blowing up with the "Thread was being stopped" exception when I
try
> to create a data connection. Here's the line of (MS VC++ .NET 2003) code
> blowing out:
> SourceConn = new
>
IBM::Data::DB2::iSeries::iDB2Connection(S"DataSource=ANTIGUA1;DefaultCollect
> ion=EMBTEST;UserID=PCS;Password=PCS;");
>
> The Exception Source is IBM.Data.DB2.iSeries.
>
> Forum discussion shows this error turning up when a thread other than the
> main application thread attempts to update a UI control while running in
the
> IDE.
>
> I'm not running in the IDE, but on a test workstation, using a Release
> compile. My application runs as a service, so there are no UI controls
> involved.
>
> Can anyone shed any light on this?
>
> thanks.
>
> Daniel Wilson
> Senior Software Solutions Developer
> Embtrak Team, DV Brown Company
> 864-292-5888
>
>