Dataset XSD does not generate code-accessible table adapters

Jon Jaques 0 Reputation points
2023-10-21T00:52:15.19+00:00

In a vb.net winforms application in VS 2022 or 2019, I create an XSD dataset and then add a table to it.

Next, I try to add data to the table, like this:

' Insert the source row into the target dataset
Dim newRow As DataRow = curvesDbDataset.AccumulatedData.NewRow()
newRow.ItemArray = sourceRow.ItemArray
newRow("workstation_name") = workstationName
curvesDbDataset.AccumulatedData.Rows.Add(newRow)

That executes without error, but no data is added to the table represented by curvesDbDataset.

The update command should look something like this:

curvesDbDataset.AccumulatedDataDataTable.Update(curvesDbDataset.AccumulatedData)

But AccumulatedDataDataTable does not exist in the object. Neither ChatGPT nor Google seem to know why.

Why can I not update the database using this method, what am I missing?

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,668 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 29,261 Reputation points Microsoft Vendor
    2023-10-23T13:20:17.38+00:00

    Hi @Jon Jaques ,

    User's image

    You need to use TableAdapter to update your dataset.

    Check the following document to see if it helps.

    Fill datasets by using TableAdapters in .NET Framework applications

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments