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)
[quoted text, click to view] "Bart Mermuys" wrote:
> Hi,
>
> "tab" <tab@discussions.microsoft.com> wrote in message
> news:ED51DF69-807D-492E-8C56-DE9838B7B12E@microsoft.com...
> > 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?
>
> 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
>
>
Hi,
[quoted text, click to view] "tab" <tab@discussions.microsoft.com> wrote in message
news:ED51DF69-807D-492E-8C56-DE9838B7B12E@microsoft.com...
> 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?
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
[quoted text, click to view] >
> Thanks