S
SAL
Hello,
I'm working on a webform that is utilizing an objectdatasource for a
detailsview web control (asp.net 2.0). I used the designer to generate the
dataset for my project and this objectdatasource is linked to a business
logic layer class that I created that is based on the dataset that was
created via the designer. There is an annex table adapter and with that I
had the designer generate update, insert and delete commands when I
generated the getAnnex query by checking the "GenerateDBDirectMethods"
checkbox.
So in my details view I click edit, modify the record and then click the
Update button. This executes the UpdateAnnex method in my business class
where the following code is executed:
The exception is raised on the last line of code before the return
statement. I looked at the class view and it shows an update command that
takes a DataRow as an argument so I'm confused by the error. Can anyone help
me with this?
Public Function UpdateAnnexation(ByVal dateReceived As Nullable(Of
DateTime), _
ByVal name As String, _
ByVal estimatedTaxImpacts As Nullable(Of Decimal), _
ByVal estimatedAssessedValue As Nullable(Of Decimal), _
ByVal gsReview As Nullable(Of DateTime), _
ByVal statuteId As Nullable(Of Integer), _
ByVal statuteRequirementsMet As Boolean, _
ByVal annexationId As Integer) As Boolean
Dim annexs As Annexationds.AnnexationsDataTable
annexs = Adapter.GetAnnexationByAnnexationId(annexationId) ' returns
a datatable
If annexs.Count = 0 Then
Return False
End If
Dim annex As Annexationds.AnnexationsRow = annexs(0)
If dateReceived.HasValue Then
annex.DateReceived = dateReceived
End If
With annex
If Not estimatedTaxImpacts.HasValue Then
annex.SetEstimatedTaxImpactsNull()
Else
.EstimatedTaxImpacts = estimatedTaxImpacts
End If
If Not estimatedAssessedValue.HasValue Then
annex.SetEstimatedAssessedValueNull()
Else
.EstimatedAssessedValue = estimatedAssessedValue
End If
If gsReview.HasValue Then
annex.GSReview = gsReview
Else
annex.SetGSReviewNull()
End If
If statuteId.Value <> annex.StatuteId Then
annex.StatuteId = statuteId.Value
End If
annex.StatuteRequirementsMet = statuteRequirementsMet
End With
Dim affectedrows As Integer = Adapter.Update(annex)
Return affectedrows = 1
End Function
I'm working on a webform that is utilizing an objectdatasource for a
detailsview web control (asp.net 2.0). I used the designer to generate the
dataset for my project and this objectdatasource is linked to a business
logic layer class that I created that is based on the dataset that was
created via the designer. There is an annex table adapter and with that I
had the designer generate update, insert and delete commands when I
generated the getAnnex query by checking the "GenerateDBDirectMethods"
checkbox.
So in my details view I click edit, modify the record and then click the
Update button. This executes the UpdateAnnex method in my business class
where the following code is executed:
The exception is raised on the last line of code before the return
statement. I looked at the class view and it shows an update command that
takes a DataRow as an argument so I'm confused by the error. Can anyone help
me with this?
Public Function UpdateAnnexation(ByVal dateReceived As Nullable(Of
DateTime), _
ByVal name As String, _
ByVal estimatedTaxImpacts As Nullable(Of Decimal), _
ByVal estimatedAssessedValue As Nullable(Of Decimal), _
ByVal gsReview As Nullable(Of DateTime), _
ByVal statuteId As Nullable(Of Integer), _
ByVal statuteRequirementsMet As Boolean, _
ByVal annexationId As Integer) As Boolean
Dim annexs As Annexationds.AnnexationsDataTable
annexs = Adapter.GetAnnexationByAnnexationId(annexationId) ' returns
a datatable
If annexs.Count = 0 Then
Return False
End If
Dim annex As Annexationds.AnnexationsRow = annexs(0)
If dateReceived.HasValue Then
annex.DateReceived = dateReceived
End If
With annex
If Not estimatedTaxImpacts.HasValue Then
annex.SetEstimatedTaxImpactsNull()
Else
.EstimatedTaxImpacts = estimatedTaxImpacts
End If
If Not estimatedAssessedValue.HasValue Then
annex.SetEstimatedAssessedValueNull()
Else
.EstimatedAssessedValue = estimatedAssessedValue
End If
If gsReview.HasValue Then
annex.GSReview = gsReview
Else
annex.SetGSReviewNull()
End If
If statuteId.Value <> annex.StatuteId Then
annex.StatuteId = statuteId.Value
End If
annex.StatuteRequirementsMet = statuteRequirementsMet
End With
Dim affectedrows As Integer = Adapter.Update(annex)
Return affectedrows = 1
End Function