Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / October 2005

Tip: Looking for answers? Try searching our database.

SQL Server and DataSet bound to DataGridView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tab - 18 Oct 2005 18:02 GMT
Using VS 2005, I've added a datasource to a DataGridView ('DGV') and this
creates the automatic designer code to bind a dataset to the DGV and a data
adapter to update the SQL database.

The problem is that if I then change the database (e.g. add a field), I need
to delete the datasource and start again (inlcuding resetting the DGV column
properties). This updates the designer code, but is a real pain when many
field changes are needed.

Is there an easier way to refresh the changes through?

Thanks
Bart Mermuys - 19 Oct 2005 15:07 GMT
Hi,

> Using VS 2005, I've added a datasource to a DataGridView ('DGV') and this
> creates the automatic designer code to bind a dataset to the DGV and a
[quoted text clipped - 9 lines]
>
> Is there an easier way to refresh the changes through?

If you are using VS 2005 don't you see a TableAdapter on the Form after
connection a Sql DataSource to the DataGridView?
If you do then right-click the TableAdapter and choose "Edit Queries in
DataSet Designer", then you should visually see your DataTable(s) and
TableAdapter(s).  Right-click on the TableAdapter and choose "Configure..."
then change your query so that it reflects the changes in the DB and
complete the wizard.

The DataGridView shouldn't loose any columns settings, at least not for
columns that are still there.

HTH,
Greetings

> Thanks
tab - 19 Oct 2005 15:41 GMT
Bart,

Thanks for your reply.

I suppose I'm being lazy (or expecting too much!) - I would have hoped there
was a mechanism for simply selecting a 'refresh' option which would do the
same thing that VS does when you first add a datasource to the DGV (i.e.
create the adapter, bindingsource and DGV columns) only just with the new
fields.

However, what you have suggested is an improvement on how I was doing it
(although I do need to add the extra field column to the DGV, it didn't do
that automatically when I tested this)

> Hi,
>
[quoted text clipped - 27 lines]
>
> > Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.