How do I pass a public variable from vb.net to a sql query in visual studio

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im creating an application using Visual Basic in Visual Studio 2010.

Using the TableAdapter there is a connection to a table in an Access database.
Private Sub EMTable_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.SummaryTableAdapter.Fill(Me.EMDataSet.Summary)
End Sub

Using Query Builder I can specify the search criteria such as:
WHERE (FlQty = 6) AND (FlD > 1 AND FlD < 2)
The table appears populated according to the hard coded query search criteria
HOWEVER what I need is to set the search criteria based on user selections on a form prior to calling the table.

EMS.FlQty
EMS.FlDmin
EMS.FlDmax
are Public variables in a Structure and I want to use them on the SQL line like this:
WHERE (FlQty = EMS.FlQty) AND (FlD >= EMS.FlDmin AND FlD <= EMS.FlDmax)
Using the variable names from the vb.net side does not work. I havent been able to figure out how to pass the values to SQL when the call is made to the table.

How do I get the values from my forms in vb.net to be recognized in the SQL code?

View the full article
 
Back
Top