The program is currently trying to pull information from three different database tables and compiling the information onto one screen, to do this i am using three different connections and a function to handle the data at each stage.
The issue is as my code hits PageLoadStage of "2" and runs the QueryDatabase() Function i am encountering an error of: "OleDB exception unhandled: No value given for one or more of the required parameters." This occurs on line 15 of the first code snippet. Can anyone explain this and/or identify any code issues if that is the cause.
Most Appreciated,
Mike
Function QueryDatabase()
Select Case PageLoadStage
Case 1
Con.ConnectionString = DBP & DBS
Con.Open()
SQL = "SELECT * FROM tbl_Information WHERE Product_Name = '" & SelectedProduct & "';"
DA = New OleDb.OleDbDataAdapter(SQL, Con)
DA.Fill(DS, "Info")
Con.Close()
Call InformationRender()
Case 2
Con.Open()
SQL = "SELECT * FROM tbl_Stock WHERE Product_Number = " & SelectedProduct & ";"
DA = New OleDb.OleDbDataAdapter(SQL, Con)
DA.Fill(DS, "Stock")
MaxLocations = DS.Tables("Stock").Rows.Count
Con.Close()
Call InformationRender()
Case 3
Con.Open()
SQL = "SELECT * FROM tbl_Location WHERE Line_Number = '" & SelectedProduct & "';"
DA = New OleDb.OleDbDataAdapter(SQL, Con)
DA.Fill(DS, "Location")
Con.Close()
Call InformationRender()
End Select
If PageLoadStage <> 4 Then
Call QueryDatabase()
End If
End Function
Function InformationRender()
Select PageLoadStage
Case 1
lbl_ProductNameV.Text = DS.Tables("Info").Rows(0).Item(1)
lbl_ProductPriceV.Text = "£" & DS.Tables("Info").Rows(0).Item(2)
lbl_AdditionalInfoV.Text = DS.Tables("Info").Rows(0).Item(3)
SelectedProduct = DS.Tables("Info").Rows(0).Item(0)
PageLoadStage = 2
Case 2
lbl_LineNumberV.Text = DS.Tables("Stock").Rows(0).Item(0)
lbl_SoldbySectionV.Text = DS.Tables("Stock").Rows(0).Item(1)
lbl_CurrentStockV.Text = DS.Tables("Stock").Rows(0).Item(2)
lbl_NextDeliveryDateV.Text = DS.Tables("Stock").Rows(0).Item(3)
lbl_NextDeliveryTimeV.Text = DS.Tables("Stock").Rows(0).Item(4)
SelectedProduct = DS.Tables("Stock").Rows(0).Item(0)
PageLoadStage = 3
Case 3
img_ProductImageDisplay.Image = DS.Tables("Location").Rows(0).Item(4)
PageLoadStage = 4
End Select
End Function