dstew
dstew

Reputation: 109

VB.Net Data Set clearing

This is a bit of an odd questions, but I'm looking through some code it does this.

dsLists.Reset()
dsLists.Clear()
dsLists.Tables("Lists").Clear()

Its throwing errors obviously on the last dsList.Tabels("Lists").Clear(), My questions is can I remove that because of the dsList.Clear above it or was the developer trying to do something else?

Thanks in advance!!

Upvotes: 1

Views: 659

Answers (1)

Victor Levin
Victor Levin

Reputation: 1177

DataSet can contain many DataTables. The first clear clears everything from your DataSet.

The second line clears specific table. You can get DataTable either by name or by index: ds.Tables(0).Clear()

The error is a symptom that DataTable "Lists" does not exist in your DataSet.

Upvotes: 1

Related Questions