BluewaterRocket
New member
Im a relative newbie to .NET as well as working with datasets. Ive put a simple app together that reproduces the problem that Ive wrestled with. I created a data adapter by dragging 10 fields from a table out of server explorer onto my form, and then created a corresponding dataset. The 10 fields (from SQL 2000 table) are all char. When I attempt to update the table with the dataset using the dataAdapter an exception gets thrown: System.MissingMemberException - Public member Value on type String not found. The watch window associates this exception with Row.ItemArray(1).Value.Value.Value - not sure what the significance of this name is as Row.ItemArry(1) is a string value. A QuickWatch of the Row shows that all 10 fields of the row are populated with string values that are within the length of the specified table columns. Heres my code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim footprintDS As DataSet = New DataSet()
Dim Row As DataRow
SqlDataAdapter1.Fill(footprintDS, "footprint")
Row = footprintDS.Tables("footprint").NewRow
Row.Item("subscriberId") = "A00000001"
Row.Item("machineId") = "jrgthinkpad"
Row.Item("numberOfApps") = "9"
Row.Item("compressedSize") = "123456789"
Row.Item("totalUncompressedSize") = "987654321"
Row.Item("compressionRatio") = "5.2"
Row.Item("physicalMemory") = "524000000"
Row.Item("registrySize") = "4000000"
Row.Item("totalDiskSpace") = "60000000000"
Row.Item("freeDiskSpace") = "10000000000"
footprintDS.Tables("footprint").Rows.Add(Row)
Try
SqlDataAdapter1.Update(footprintDS, "footprint")
Catch
Finally
If footprintDS.HasErrors Then
Console.WriteLine("Error: ")
Else
Console.WriteLine("OK!")
End If
End Try
End Sub
Ive attached a screenshot with the quickwatch values, as well as the text of the exception in the watch window.
Any help appreciated as Ive reached the limits of my .NET, Dataset, and exception handling knowledge.
Thanks,
Jim
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim footprintDS As DataSet = New DataSet()
Dim Row As DataRow
SqlDataAdapter1.Fill(footprintDS, "footprint")
Row = footprintDS.Tables("footprint").NewRow
Row.Item("subscriberId") = "A00000001"
Row.Item("machineId") = "jrgthinkpad"
Row.Item("numberOfApps") = "9"
Row.Item("compressedSize") = "123456789"
Row.Item("totalUncompressedSize") = "987654321"
Row.Item("compressionRatio") = "5.2"
Row.Item("physicalMemory") = "524000000"
Row.Item("registrySize") = "4000000"
Row.Item("totalDiskSpace") = "60000000000"
Row.Item("freeDiskSpace") = "10000000000"
footprintDS.Tables("footprint").Rows.Add(Row)
Try
SqlDataAdapter1.Update(footprintDS, "footprint")
Catch
Finally
If footprintDS.HasErrors Then
Console.WriteLine("Error: ")
Else
Console.WriteLine("OK!")
End If
End Try
End Sub
Ive attached a screenshot with the quickwatch values, as well as the text of the exception in the watch window.
Any help appreciated as Ive reached the limits of my .NET, Dataset, and exception handling knowledge.
Thanks,
Jim