HELP! Databound Update(untyped dataset)

S

steroche

I am trying to perform an update of a databound datagrid. I just cant
figue out how to update the rows and though. Every example i come
across either uses that example with the FindbyCategoryID method in a
typed dataset or uses a DataView which i dont think i want to do
either.
How do i get the inputted values of the selected fields out of the
datagrid and update the dataset from these?
Can anybody help please?
Thanks
 
P

Phillip Williams

steroche said:
I am trying to perform an update of a databound datagrid. I just cant
figue out how to update the rows


There are many ways. One simple way is to use a primary key on the table.
When you bind the DataTable to the grid you specify a DataKeyField. Then in
the method that updates your data you find the rows in the table by using
that DataKey. I have an example on this link that does that:
http://www.societopia.net/samples/datagrid_3.aspx

This example also demonstrates how to highlight a selected row on a grid
while displaying the details of that row in another grid (which answers the
question that you posted in another thread)

HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
 
S

steroche

Do i have to use a DataTable to perform an update on the DataGrid and
make changed to the db???
 
P

Phillip Williams

steroche said:
Do i have to use a DataTable to perform an update on the DataGrid and
make changed to the db???

Hello Steroche,

A DataTable is just one of several other objects that implement the
IEnumerable interface. Refer to the MSDN documentation for a description of
the datagrid.datasource:

http://msdn.microsoft.com/library/d...bcontrolsbasedatalistclassdatasourcetopic.asp

As for updating the database, you can use the DataAdapter:

http://msdn.microsoft.com/library/d...ientsqldataadapterclassupdatecommandtopic.asp

HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top