DataAdapter, DataSets and Datatables

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
 
Z

zacks

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?
 

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

Top