Hello,
I have a table "t_GallonsPerPound" where there is the following fields: Id, TP as [True Proof], WG as [Wine Gallons] and PG as [Proof Gallons]
I have a form that i am trying to take the value from a txtTP compare it to the database and pull the rest of the information from that record and populate the other two read only text boxes. This happens when the button is clicked
That is if 184 is entered
TP WG PG
----- ----- ----
184 .114 .252
the text boxes fill with those two numbers respectivly.
Since this is my first attempt in VB.net to access a database... i am somewhat lost... Any help. This is what i have so far.
Private Sub btnLookup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLookup.Click
DaGallons.SelectCommand.CommandText = "SELECT [ID], [True Proof], [Wine Gallons], [Proof Gallons] FROM t_GallonsPerPound where TrueProof = '" & txtTP.Text & "'"
MessageBox.Show(DaGallons.SelectCommand.CommandText) ' This appears ok in the pop-up.
End Sub
This is where i get stuck.. I dont know how to get the information.. Normally in VB or ASP the above select statement would return 1 record... but i dont know what the syntax is for VB.net r how to reference it to set the values of the textboxs.
This is just one part of an application i am developing.. hopefully i will turn this into
entering the True Proof, automatically looking up the other values, entering everything into another database table, but i suppose one step at a time..
Any help is appreciated.. i assume this is a pretty simple request.
Dim dt As DataSet.t_GallonsPerPound = DaGallons.Tables("t_Gallon
Dim dr As DataSet.t_GallonsPerPoundR
txtWG.Text = Dr.Wine.Value
txtPG.Text = Dr.ProofGallons.Value
Bob