Problem with MultiThreading...

Discussion in '.NET' started by joseph20, Apr 30, 2011.

  1. joseph20

    joseph20

    Joined:
    Jul 18, 2008
    Messages:
    3
    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: May 2, 2011
    joseph20, Apr 30, 2011
    #1
    1. Advertising

  2. joseph20

    joseph20

    Joined:
    Jul 18, 2008
    Messages:
    3
    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
    joseph20, May 2, 2011
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. insomniac

    ASP.Net 2.0 Multithreading Problem

    insomniac, Apr 27, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,700
    insomniac
    Apr 27, 2006
  2. Lee Garrington

    Multithreading beginner problem

    Lee Garrington, Dec 22, 2003, in forum: C++
    Replies:
    1
    Views:
    552
    Thomas Matthews
    Dec 22, 2003
  3. abhra.haldar@gmail.com
    Replies:
    1
    Views:
    3,130
    bruce barker \(sqlwork.com\)
    May 11, 2006
  4. Diez B. Roggisch

    multithreading-problem

    Diez B. Roggisch, Jul 27, 2003, in forum: Python
    Replies:
    4
    Views:
    330
    Diez B. Roggisch
    Jul 27, 2003
  5. abhinav

    Python multithreading problem

    abhinav, Mar 26, 2006, in forum: Python
    Replies:
    3
    Views:
    369
    abhinav
    Mar 27, 2006
Loading...

Share This Page