Hi There,
here is a form from my VS2013C Project
As you can see, there are 9 labels that need filling.
My Question is, can I load the dataset with 9 different select statements from the same Table, and then fill the 9 labels with the correct data.?
("select MIN(price_a_liter) from petrol_table where fueldate >= " & "'" & M12S & "'" & " and fueldate < " & "'" & M12F & "'", CON)
("select MIN(total_liters) from petrol_table where fueldate >= " & "'" & M12S & "'" & " and fueldate < " & "'" & M12F & "'", CON2)
("select MIN(total_dollars) from petrol_table where fueldate >= " & "'" & M12S & "'" & " and fueldate < " & "'" & M12F & "'", CON3)
The above is just 3 of the statements that I need to do....
Dim M12S As String = Places.Item(0)
Dim M12F As String = Places.Item(1)
'Get SQL MIN (Price@Liter)
'Create a NEW SQL Connection String
Dim CON As New SqlConnection
CON.ConnectionString = "Data Source=i7borgmatrix2\sqlexpress;Initial Catalog=Petrol_Costs;Integrated Security=True;"
'Create a NEW SQLDB DataAdapter
Dim SQLDAdP As SqlDataAdapter = New SqlDataAdapter("select MIN(price_a_liter) from petrol_table where fueldate >= " & "'" & M12S & "'" & " and fueldate < " & "'" & M12F & "'", CON)
CON.Close()
'Create a NEW DataSet
Dim DS As New DataSet
Dim dt As New DataTable
'Fill Data Adapter
SQLDAdP.Fill(DS, "load")
' Fill Data Tables
dt = DS.Tables("load")
The above code , is how I am doing it at the moment,if I have to do it this way, it means 9 sets of code just like this. The only diffenent being the "AVG","MIN","MAX"
Thanks for reading.