DataAdapter, DataSets and Datatables

  • Thread starter Thread starter Teo
  • Start date Start date
T

Teo

Hey guys!!
I am looking at a user friendly tutorial on how to use Dataadapters,
datatables and datasets to fill datagrids, etc.
I am confused on using them a lot. Now I mostly use Datareaders and
Nonqueries to enter and retrieve data in and out of DB.

Please help.
Thanks,
Teo
 
Hey guys!!
I am looking at a user friendly tutorial on how to use Dataadapters,
datatables and datasets to fill datagrids, etc.
I am confused on using them a lot. Now I mostly use Datareaders and
Nonqueries to enter and retrieve data in and out of DB.

I recently figured that out by reading the online help which has some
good example code.

But basically all you need is a connection, then a command attached to
the connection. Set the Command's CommandText property to the desired
SELECT statement. Then set a dataadapter's command (using the
DataAdapter.SelectCommand property) to the command. Next, fill a
DataSet using the DataAdapter.Fill method. Set a DataTable to the
appropriate table in the DataSet and lastly, set a DataGridView (or
other comparable control) DataSource property to the DataTable.

There may be a simpler way to do it, but I can guarentee this way
works. It works for me just fine.

Got it?
 
Back
Top