Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / October 2004

Tip: Looking for answers? Try searching our database.

Calling method on different Thread?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Torben Philippsen - 24 Oct 2004 12:56 GMT
Hello!

In my application I am executing some sql statements on a different thead.
For that task I have created an ExeCuteSQLCOmmand class.

When pressing run in my mail application the following happens:

void run()
{
executeSQLCommand = new ExecuteSQLCommand(getTextConstants(), null,
getConnection(), getOdbcConnection(), statements);
ThreadStart executeSQLCommandThreadStart = new
ThreadStart(executeSQLCommand.run);
Thread executeSQLCommandThread = new Thread(executeSQLCommandThreadStart);
executeSQLCommandThread.Start();
}

In the ExecuteSQLCommand class i have implementet a cancel method, that
cancels all sql statements from being executed. My problem is when calling
this method from my main application:
executeSQLCommand.cancel();

I get multiple errros saying that some of my objects used to execute sql
statements (OdbcConnection, OdbcCommand, OdbcReader) aren't set to an
instance of an object - but they are??
Do you have any idea what I am doing wrong?

I haven't got great experience in running applications on more than one
tread, any help would really be appreciated.

Thank you very much
Torben
Jon Skeet [C# MVP] - 24 Oct 2004 18:01 GMT
> In my application I am executing some sql statements on a different thead.
> For that task I have created an ExeCuteSQLCOmmand class.

<snip>

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Torben Philippsen - 26 Oct 2004 17:00 GMT
Hi Jon!

Thank You for your reply.
Making a short complete program is not easy doable, but I will look into it
and repost.

I appreciate your help.

Best regards Torben

> > In my application I am executing some sql statements on a different thead.
> > For that task I have created an ExeCuteSQLCOmmand class.
[quoted text clipped - 6 lines]
> See http://www.pobox.com/~skeet/csharp/complete.html for details of
> what I mean by that.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.