Newbee Question - Updating Data With a DataGridView

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm new to VS2005 and want to simply update my data with the dataGridView
that was generated when I draged my query from the Data Sources Pane. I
think I may need to create a Data Adaptor but I'm not sure? The other think
I saw was to implement IEditable? How would I do that? Where in my code
woudl I do that considering I am not creating the DataGridView via code?

I know this is probably the easist thing to do I just don't know how?

Thanks in advance,
 
Well, you can't expect Visual Studio to do everything for you, simply
because there are so many possible combinations of things programmers want
to do. It provides some excellent tools that will save you a lot of time,
but at some point you have to know what it is that it is doing for you, and
be able to work with it.

Basically, here's a clue for you. When you did that dragging and dropping,
Visual Studio was busily writing code that defines a number of classes,
including strongly-typed DataSets, DataTables, and DataAdapters. It is a
DataAdapter that provides the link between the DataSet and the underlying
Data Store (in this case a database). And even though Visual Studio didn't
need to include code to update the database, delete or insert new records,
into it, in order to populate your DataSet for you, it did write that
functionality in there. Microsoft anticipated that you might want to do
something like that.

So, you just need to look at the classes that were developed for you, find
the functionality you need, and use it.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
Hi,

As you know, you can use a DataAdapter to update all the newly added rows,
modified rows and deletions to the database. You needn't implement the
IEditable interface. Here is a good article for your reference.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
ml/databindingadonet.asp

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Thanks for the time, I guess the question is where is the dataAdaptor that
the wizard creates? How do I access the update capabilities? I see a
tableAdaptor that is created, is that what I'm looking for? If not what is
the name of my dataAdaptor and where does it live?

Thanks
Greg
 
The code for it should be in your project. If you see an XSD file for your
DataSet, expand it and look at the Designer for it, or use the Class View to
examine the class structures.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
Kevin,

Thank you much for that article, it was very well written. I have a similar
issue now and if you think I should open a new thread I will. I am trying to
update a view. When you drag a datagridview that is created from a view I
understand that the .update method is not created. How do I add this? Where
do I place the code so that it isn't overwirtten? In general how do I update
through a view?

Thanks,
Greg P.
 
Hi Greg,

I have posted a reply on your new thread.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top