Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Help

Status
Not open for further replies.

Djbell

IS-IT--Management
Apr 22, 2002
175
GB
Hi all

I have a TableAdaptor with the following Query..

SELECT Start, Finish, Prod1, Prod2, Prod3, AutoID
FROM RecordProduction
WHERE (Department = @PrmDepartment) AND (RecordDate = @PrmDate) AND (Batch = @PrmBatch) AND (System = @PrmSystem) AND
(Component = @PrmComponent) AND (RecordSize = @PrmSize)

As you can see I am using Parameters to filter down the query.

On My form I have a datagrid that gets its information from the above query, also on my form I have some Combo Boxes and text boxes, what I want is the Parameters to be associated with values in the combo boxes and text boxes, so that when I click on a button to refrsh the datagrid it show the information based on what the user selects in the combo boxes and text boxes.. I just cant figure out how to pass the information from the controls to the parameters..

Any help is appreciated.

Regards

Douglas Bell

 
Here's an example of a TableAdapter I use.

Code:
    Try
      Me.DailyAssOppRwkTableAdapter.Fill(Me.DataSetDailyAssRwk.DailyAssOppRwk, CurAssPartNo, CurAssOppNo, CurDate)
    Catch ex As System.Exception
      MsgBox("Daily Rework Data Error" + vbCrLf + ex.Message, MsgBoxStyle.Exclamation, "DATA NOT LOADED")
    End Try

I declared CurAssPartNo, CurAssOppNo and CurDate as variables. You can assign the contents of your controls to variables and use the same method.
 
Hi

Sorry I am new to VB.Net and SQL, so bare with me if I am being silly, I have tried your suggestion I get no errors but I also get no data in my grid, is this what you mean..

Private Sub UpdateGrid()

Dim PrmDepartment as string = LblDepartment.Text
Dim PrmDate as string = TxtDate.Text
Dim PrmBatch as string = CbBatch.Text
Dim PrmSystem as string = CbSystem.Text
Dim PrmComponent as string = CbComponent.Text
Dim PrmSize as string = CbSize.Text

Try
Me.ProductionTableAdapter.Fill(Me.DataSetProduction.Production, PrmDepartment, PrmDate, PrmBatch,PrmSystem,PrmComponent,PrmSize)
Catch ex As System.Exception
MsgBox("Daily Rework Data Error" + vbCrLf + ex.Message, MsgBoxStyle.Exclamation, "DATA NOT LOADED")
End Try

End Sub

I call the UpdateGride from a button and reload the DataGrid

Regards

Douglas Bell
 
Hi all

I am still stuck on the above, so any frther help would be appreciated..

Regards

Douglas Bell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top