views:

20

answers:

0

Need: Need to bind data to WPF controls for a user to update a database.

Approach: I am trying to implement a solution similar to this but am having an issue because I will be using a DataSet and not LINQ to SQL Class (hitting an Oracle db for my data). If this is a correct approach how can I do this?

I'm also thinking instead of adding the data to the collection, why don't I bind directly to the dataset and use the events (RowChanged) of the dataset to update my database. I'm new to WPF so I'm sure there is a good reason.

My form:

Public Class frmTest
Private Shared _adjData As New BudgetTrackDAL.dsBudgetChangeIndirect()
Private _adjCollection As ObservableAdjustments

Private Sub frmTest_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
    _adjData = DB.GetBudgetAdjustments("501", "", "2010")
    ' Pass populated dataset
    _adjCollection = New ObservableAdjustments(_adjData)
End Sub

My Collection Class:

Public Class ObservableAdjustments
Inherits ObservableCollection(Of BudgetTrackDAL.dsBudgetChangeIndirect)
Public Sub New(ByVal myDataSet As dsBudgetChangeIndirect)
    '***********************
    ' This is where I want to load the collection from my dataset
    For Each row In myDataSet
        Add(row)
    Next
    '***********************
End Sub

End Class