|
-
Aug 24th, 2011, 11:18 AM
#1
Thread Starter
Hyperactive Member
TaskFactory and datasets
I have a taskfactory application that generates new tasks where a task is running a project exe file that involves a lot of classes. Part of the task process involves declaring a dataset and adding a single datatable to the dataset which is then populated with content from results of a sql query. This datatable is then used in the next class and involves iterating through the table and deleting the rows it has already used. When initiating a new task I assume that it will declare its own datatable and dataset but not sure if this will work. Any comments or suggestions.
...declaring a new datatable in method that each task runs
Code:
dsCountry = New Dataset
dsTable = New DataTable
dsCountry.Tables.add(dsTable)
-- Please rate me if I am helpful --
-
Aug 24th, 2011, 08:33 PM
#2
Re: TaskFactory and datasets
First up, you should understand the difference between declaring a variable and creating an object. You declare a variable using the Dim keyword. That variable exists within the scope it was declared. When you create an object, generally done using the New keyword, you will often, but not always, assign it to a variable. The same object might be assigned to multiple variables in different scopes, e.g. you can create a String object in one form and pass it to another via a method or property. Both forms would have their own String variable but there would only be one String object.
So, if you declare a variable in a method, whether that method constitutes a task or not. That variable exists in that method and nowhere else. If you use the New keyword to create an object within that method, each time that method is executed, you will create a new object. If multiple tasks execute that method then each task will create its own object.
-
Sep 15th, 2011, 04:43 PM
#3
Thread Starter
Hyperactive Member
Re: TaskFactory and datasets
Thanks for the clarification. Gonna think of a practical soln and post back
-- Please rate me if I am helpful --
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|