SweetingA
asked on
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_Selected IndexChang ed(sender As System.Object, e As System.EventArgs) Handles cboPeriodSelector.Selected IndexChang ed
SQL.SQLDataSet.Clear()
If cboPeriodSelector.Selected Index = 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.SQLData Set, "qry_OEE_Hourly")
ChartOEE.DataSource = SQL.SQLDataSet.Tables("qry _OEE_Hourl y")
Dim Series1 As Series = ChartOEE.Series(0)
Series1.Name = "Hourly OEE"
ChartOEE.Series(Series1.Na me).XValue Member = "Hour"
ChartOEE.Series(Series1.Na me).YValue Members = "OEE"
ChartOEE.Series(0).CustomP roperties = "DrawingStyle = Cylinder ,PixelPointWidth = 15"
ChartOEE.ChartAreas(0).Axi sX.Title = "Hour"
ChartOEE.ChartAreas(0).Axi sY.Title = "% OEE"
ChartOEE.ChartAreas(0).Axi sX.Minimum = -1
ChartOEE.ChartAreas(0).Axi sX.Maximum = 24
ChartOEE.ChartAreas(0).Axi sY.Minimum = 0
ChartOEE.ChartAreas(0).Axi sY.Maximum = 120
ChartOEE.ChartAreas(0).Axi sX.Interva l = 1
ChartOEE.ChartAreas(0).Axi sY.Interva l = 20
ChartOEE.ChartAreas(0).Axi sX.TitleFo nt = New Font("Arial", 10, FontStyle.Bold)
ChartOEE.ChartAreas(0).Axi sY.TitleFo nt = New Font("Arial", 10, FontStyle.Bold)
ChartOEE.ChartAreas(0).Axi sX.LabelSt yle.Font = New Font("Arial", 6)
ChartOEE.ChartAreas(0).Axi sY.LabelSt yle.Font = New Font("Arial", 6)
ChartOEE.ChartAreas(0).Axi sX.MajorGr id.LineDas hStyle = DataVisualization.Charting .ChartDash Style.Dash
ChartOEE.ChartAreas(0).Axi sY.MajorGr id.LineDas hStyle = DataVisualization.Charting .ChartDash Style.Dash
ChartOEE.ChartAreas(0).Axi sX.LabelSt yle.Angle = 0
ChartOEE.Series(0).XValueT ype = ChartValueType.Int32
Exit Sub
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_Selected
SQL.SQLDataSet.Clear()
If cboPeriodSelector.Selected
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.
Exit Sub
End If
SQL.SQLDA.Fill(SQL.SQLData
ChartOEE.DataSource = SQL.SQLDataSet.Tables("qry
Dim Series1 As Series = ChartOEE.Series(0)
Series1.Name = "Hourly OEE"
ChartOEE.Series(Series1.Na
ChartOEE.Series(Series1.Na
ChartOEE.Series(0).CustomP
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.ChartAreas(0).Axi
ChartOEE.Series(0).XValueT
Exit Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes you are right, i was just a fool - it was so simple in the end, they completed instantaneously
Hope that helps.