update function


Scott M.


I just want to write a update function in class of .net,& i want fecth
data from db table, so can you explian me with any example.

EggHeadCafe - Software Developer Portal of Choice
ADO.NET 2.0 DataSet as a Self-Contained, Remoteable Compressed Object

So you want to Select and Update then.

You'll need to establish a connection to the database, so you'll have to
pick a particular .NET Provider (standard ones are OleDb, SqlClient, Odbc
but others exist as well) to use because the provider you choose determines
the particular classes that you'll be using.

Once you've chosen a Provider, you'll need to create a connection instance
and that means you'll need to configure it with the proper connection

After the connection is instantiated and open, you'll need a command to
actually do the select and inserting. Based on whether you'll be using
stored procedures on SQL statements passed to the database, you'll have to
set up the commands accordingly.

Once the commands are set up, you can execute them. With an update, you're
only interested in how many records were affected and with a select, you
either want to iterate through the results directly (which means you'll want
a DataReader) or store them for later use (in a DataSet or DataTable).

As you can see, there is a basic process here, but without specfiic details
about what you data source is and what kind of queries you want to perform,
there could be many different configuration scenarios.

If you Google on "Introduction to ADO .NET", you'll find many resources that
can get you started.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question