I am quickly learning with .NET that a "snippet" of code can make the difference between 15 minutes and 15 hours...
I am using a JET 4 OLEDB connection to Access, programming in Visual Basic...what few successes I have, I will try and post for those who embrace time as much as I do...
TOPIC: Changing a Recordset in a DataGrid using a Drop down or Combo box...
SETUP: Connection, DataAdapter and DataSet dragged to the form in Visual Basic Studio....
Code placed in the SelectedIndexChanged Event...
OBJECTS:
OLEDB Connection: OleDbConnection1
DataAdapter object: OleDbDataAdapter1
DataSet: DsGrpSummary
Drop down box: ddWID
...and we're off...
Dim MyWShedCommand As String
MyWShedCommand = "SELECT * from " & "tblGrpSummary WHERE " & "WatershedID ='" & ddWID.SelectedItem.Value & "'"
Dim cmdWShed As New OleDbCommand(MyWShedCommand, OleDbConnection1)
OleDbDataAdapter1.SelectCommand = cmdWShed
DsGrpSummary.Clear()
OleDbDataAdapter1.Fill(DsGrpSummary)
DataGrid1.DataBind()
I am using a JET 4 OLEDB connection to Access, programming in Visual Basic...what few successes I have, I will try and post for those who embrace time as much as I do...
TOPIC: Changing a Recordset in a DataGrid using a Drop down or Combo box...
SETUP: Connection, DataAdapter and DataSet dragged to the form in Visual Basic Studio....
Code placed in the SelectedIndexChanged Event...
OBJECTS:
OLEDB Connection: OleDbConnection1
DataAdapter object: OleDbDataAdapter1
DataSet: DsGrpSummary
Drop down box: ddWID
...and we're off...
Dim MyWShedCommand As String
MyWShedCommand = "SELECT * from " & "tblGrpSummary WHERE " & "WatershedID ='" & ddWID.SelectedItem.Value & "'"
Dim cmdWShed As New OleDbCommand(MyWShedCommand, OleDbConnection1)
OleDbDataAdapter1.SelectCommand = cmdWShed
DsGrpSummary.Clear()
OleDbDataAdapter1.Fill(DsGrpSummary)
DataGrid1.DataBind()