J
Jeff Bunting
I have a class that pulls data from a stored procedure into a datatable and
is using the DataRowModified property to determine whether to update the
data when the class is saved or disposed. So I have this:
Public Property LastName() As String
Get
LastName = ThisRecord("lastname")
End Get
Set(ByVal Value As String)
If Me.LastName <> Value Then ThisRecord("lastname") = Value
End Set
End Property
Public Sub Save()
If ThisRecord.RowState = DataRowState.Modified Then
WS.UpdateContact(DS1)
End Sub
ThisRecord is a DataRow,WS is a web service, DS1 is a DataSet
Works fine with existing data. When I create a new instance of the class
that doesn't have any pre-existing data in it then ThisRecord is undefined.
I was trying to decide the best way to handle this. Can I create a table
and row based on the class with empty values and continue to use the
DataRowState.Modified, or is there a better way? I don't want to do submit
any changes back to the database unless a value has changed and this seemed
to be the way to do it.
Jeff
is using the DataRowModified property to determine whether to update the
data when the class is saved or disposed. So I have this:
Public Property LastName() As String
Get
LastName = ThisRecord("lastname")
End Get
Set(ByVal Value As String)
If Me.LastName <> Value Then ThisRecord("lastname") = Value
End Set
End Property
Public Sub Save()
If ThisRecord.RowState = DataRowState.Modified Then
WS.UpdateContact(DS1)
End Sub
ThisRecord is a DataRow,WS is a web service, DS1 is a DataSet
Works fine with existing data. When I create a new instance of the class
that doesn't have any pre-existing data in it then ThisRecord is undefined.
I was trying to decide the best way to handle this. Can I create a table
and row based on the class with empty values and continue to use the
DataRowState.Modified, or is there a better way? I don't want to do submit
any changes back to the database unless a value has changed and this seemed
to be the way to do it.
Jeff