all groups > dotnet windows forms databinding > october 2005 >
You're in the

dotnet windows forms databinding

group:

SQL Server and DataSet bound to DataGridView


SQL Server and DataSet bound to DataGridView tab
10/18/2005 10:02:07 AM
dotnet windows forms databinding:
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?

Re: SQL Server and DataSet bound to DataGridView tab
10/19/2005 7:41:06 AM
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]
Re: SQL Server and DataSet bound to DataGridView Bart Mermuys
10/19/2005 4:07:43 PM
Hi,

[quoted text, click to view]

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]

AddThis Social Bookmark Button