Problem with MultiThreading...

Joined
Jul 18, 2008
Messages
3
Reaction score
0
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:
Joined
Jul 18, 2008
Messages
3
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top