Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem with MultiThreading...

Reply
Thread Tools

Problem with MultiThreading...

 
 
joseph20 joseph20 is offline
Junior Member
Join Date: Jul 2008
Posts: 3
 
      04-30-2011
Hi All,

I am creating windows application in vb.net and I have problem related to multiple threading. Let me describe you the scenario and what are the problems I am facing.

On form Load I am creating the thread the calling the relevant methods.

like below:



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim objThread As System.Threading.Thread
Dim i as integer

For i=0 to 4


objThread = New Thread(AddressOf _startExtractThread)
objThread.Start()

Next


End Sub


Here in this method I am creating one sTempName variable and then I pass that variable as the Name of file and temporary tables to other methods.


Public Sub _startExtractThread()

dim sTempName as string = "Temp_" & Format(Date.Now, "yyMMdd_HHmmss")

''Now this variable I am passing to other methods for different task.

''Below method will create temporary table

getDMTableSchema(objlistCollection, sTempName, sLogFile)


''I am inserting records in this table so in that also i will pass the same variable name

InsertRecords(sTempName,sUserID, sUserPermID, sGroupID, sLogFile)

'then I am writing those records in to the CSV file, so for creating csv file again I am passing this sTempName variable

writeRecords(sTempName,sExportFolder)


'then I am deleting the temporary created table

sLogSQL = "drop table " & sTempName
iSuccess = dbExecuteSQL(sLogSQL, sLogFile)


End Sub


In the above scenario what I want is if 4 thread are getting created then it should create 4 temporary table and 4 CSV files with different names.

after that all the 4 temporary table should be dropped.

But at the movement it is creating only 1 table and 1 csv file and repeating the records in the csv which it retireve from the table.

Please shed some light and give some idea and hint.

Many Thanks
-Joseph
 

Last edited by joseph20; 05-02-2011 at 12:00 PM..
Reply With Quote
 
 
 
 
joseph20 joseph20 is offline
Junior Member
Join Date: Jul 2008
Posts: 3
 
      05-02-2011
Hello Experts,



Could someone please shed some light on this problem who is expert and have good knowledge in Threading.



Please give some hint or work around on this problem.



Thanks

Joseph
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments