Billy Yang
Member
- Joined
- Oct 6, 2004
- Messages
- 6
- Programming Experience
- 3-5
Hello,
I write a small program to build a web service. I fill a dataset with data from VFP database. After I put a record in the dataset and make the update. When updating the database I get an error described like this: "System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at VT_HRSWebServices.HRSService.UpdateObservation() in C:\Inetpub\wwwroot\VT_HRSWebServices\HRSService.asmx.vb:line 171"
The instruction where it fails is: HRSAdapterObs.Update(DSObs, "observation")
I don't know what to do to resolve this error.
Bye
Here is the code:
HRSAdapterObs.Fill(DSObs, "observation")
LNewRow = DSObs.Tables("observation").NewRow
With LNewRow
.Item("round") = 1250
.Item("date") = Today
.Item("begin_time") = "10:20"
.Item("end_time") = "10:25"
.Item("entry_date") = Today
End With
DSObs.Tables("observation").Rows.Add(LNewRow)
LRowsUpatedCount = 0
Try
HRSAdapterObs.Update(DSObs, "observation")
LRowsUpatedCount = LRowsUpatedCount + 1
Catch e As Exception
Return -1
End Try
Return LRowsUpatedCount
I write a small program to build a web service. I fill a dataset with data from VFP database. After I put a record in the dataset and make the update. When updating the database I get an error described like this: "System.NullReferenceException: Object reference not set to an instance of an object.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at VT_HRSWebServices.HRSService.UpdateObservation() in C:\Inetpub\wwwroot\VT_HRSWebServices\HRSService.asmx.vb:line 171"
The instruction where it fails is: HRSAdapterObs.Update(DSObs, "observation")
I don't know what to do to resolve this error.
Bye
Here is the code:
HRSAdapterObs.Fill(DSObs, "observation")
LNewRow = DSObs.Tables("observation").NewRow
With LNewRow
.Item("round") = 1250
.Item("date") = Today
.Item("begin_time") = "10:20"
.Item("end_time") = "10:25"
.Item("entry_date") = Today
End With
DSObs.Tables("observation").Rows.Add(LNewRow)
LRowsUpatedCount = 0
Try
HRSAdapterObs.Update(DSObs, "observation")
LRowsUpatedCount = LRowsUpatedCount + 1
Catch e As Exception
Return -1
End Try
Return LRowsUpatedCount