troubleshooting Question

MultiThreading Help

Avatar of narmi2
narmi2 asked on
Visual Basic.NET
9 Comments1 Solution412 ViewsLast Modified:

I have a class which freezes my application when it is doing its thing!

All the class does is query a database and returns a datatable e.g.

Option Strict On

Imports System.Data
Imports System.Data.SqlClient

Public Class OriginalData

    Dim objDataSet As DataSet
    Dim objSQLConnection As SqlConnection
    Dim objSQLDataAdapter As SqlDataAdapter

    ReadOnly Property TheData(ByVal myquery As String) As DataTable
            TheData = TheQuery(myquery)
        End Get
    End Property

    Private Function TheQuery(ByVal myQuery As String) As DataTable
        objSQLConnection = New SqlConnection("the connection string here")
        objSQLDataAdapter = New SqlDataAdapter(myQuery, objSQLConnection)
        objDataSet = New DataSet

        objSQLDataAdapter.Fill(objDataSet, "tblOriginal")

        Return objDataSet.Tables("tblOriginal")
    End Function

End Class
----------end code-----------

and I use it like this:


objDataTable = objOriginalData.TheData("sql query in here")

----------end code-----------

How do I "MultiThread" this so it does not freeze the application?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros