Updating the database using dataset and dataadapter

20 Apr

Data Sets are a more complex and feature-rich object than Data Readers.Whereas Data Readers simply scuttle data back from a data store, Data Sets can be thought of as in-memory databases.NET, the Data Reader is roughly thirty times more performant than the Data Set.

Since a Data Set represents a separate, disconnected collection of data, it's no surprise that the Data Set's data is both editable and can be accessed randomly, two traits not exhibited by the Data Reader.

Data Readers are connected data objects because they require an active connection to the database.

Remember, the Data Reader is just a ferry of data between the application and database.

Open() ' Create command Dim my Command as New Sql Command(SQL query or stored procedure, my Connection) ' Create a Data Reader to ferry information back from the database Dim my Reader as Sql Data Reader my Reader = my Command. End While ' Close the connection (will automatically close the reader) my Connection.

Execute Reader() 'Iterate through the results While my Reader. Close() method returns True if a row was loaded from the database, and False if there are no more rows.