Running multiple SQL queries at the same time from vb

Hello Experts....

This may be a very simple one for those who know but not for me!
I want to populate 4 different charts at the same time from 4 different SQL tables.
The code below i am using for one chart.
Do i simply refernce 4 different adaptors anf datasets or is there a more elegant way?

Thanks in advance

    Private Sub cboPeriodSelector_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboPeriodSelector.SelectedIndexChanged

        SQL.SQLDataSet.Clear()
        If cboPeriodSelector.SelectedIndex = 0 Then
            datStart.Visible = False
            datEnd.Visible = False
            labDateFilter.Visible = False
            labTo.Visible = False
            SQL.RunQuery("SELECT OEE As OEE, Hour As Hour FROM qry_OEE_Hourly")
            If SQL.recordcount = 0 Then
                MsgBox("No records available for this selection", vbExclamation + vbOKOnly, "Message")
                ChartOEE.Series(0).Points.Clear()
                Exit Sub
            End If
            SQL.SQLDA.Fill(SQL.SQLDataSet, "qry_OEE_Hourly")
            ChartOEE.DataSource = SQL.SQLDataSet.Tables("qry_OEE_Hourly")
            Dim Series1 As Series = ChartOEE.Series(0)
            Series1.Name = "Hourly OEE"
            ChartOEE.Series(Series1.Name).XValueMember = "Hour"
            ChartOEE.Series(Series1.Name).YValueMembers = "OEE"
            ChartOEE.Series(0).CustomProperties = "DrawingStyle = Cylinder ,PixelPointWidth = 15"
            ChartOEE.ChartAreas(0).AxisX.Title = "Hour"
            ChartOEE.ChartAreas(0).AxisY.Title = "% OEE"
            ChartOEE.ChartAreas(0).AxisX.Minimum = -1
            ChartOEE.ChartAreas(0).AxisX.Maximum = 24
            ChartOEE.ChartAreas(0).AxisY.Minimum = 0
            ChartOEE.ChartAreas(0).AxisY.Maximum = 120
            ChartOEE.ChartAreas(0).AxisX.Interval = 1
            ChartOEE.ChartAreas(0).AxisY.Interval = 20
            ChartOEE.ChartAreas(0).AxisX.TitleFont = New Font("Arial", 10, FontStyle.Bold)
            ChartOEE.ChartAreas(0).AxisY.TitleFont = New Font("Arial", 10, FontStyle.Bold)
            ChartOEE.ChartAreas(0).AxisX.LabelStyle.Font = New Font("Arial", 6)
            ChartOEE.ChartAreas(0).AxisY.LabelStyle.Font = New Font("Arial", 6)
            ChartOEE.ChartAreas(0).AxisX.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dash
            ChartOEE.ChartAreas(0).AxisY.MajorGrid.LineDashStyle = DataVisualization.Charting.ChartDashStyle.Dash
            ChartOEE.ChartAreas(0).AxisX.LabelStyle.Angle = 0
            ChartOEE.Series(0).XValueType = ChartValueType.Int32
            Exit Sub
SweetingAAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Luis PérezSoftware Architect in .NetCommented:
If you really want to do it "at the same time", you'll need the help of threading. You can use the core classes from System.Threading as well as the BackgroundWorker control/component, which is easier to use.

Hope that helps.
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>Do i simply refernce 4 different adaptors anf datasets or is there a more elegant way?

It all depends on what you mean by at the same time.  Assuming all the queries will complete rapidly then it may well be good enough.  However if one query takes 60 seconds and the other three take 1 second in total then even using threading wont be of much help.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SweetingAAuthor Commented:
Yes you are right, i was just a fool - it was so simple in the end, they completed instantaneously
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.