Hi Mark
I do not know your code ...
Normaly you would fill a grid like this:
**************
// Variables
public System.Data.SqlClient.SqlConnection return_SQLNATIVEConnection = new
System.Data.SqlClient.SqlConnection();
// Create Connection
return_SQLNATIVEConnection.ConnectionString = "Data
Source=SQLServer\SQLInstance;Initial Catalog=SQLDatabase;Integrated
Security=SSPI;";
return_SQLNATIVEConnection.Open();
// DataAdapter erstellen
System.Data.SqlClient.SqlDataAdapter local_DataAdapter = new
System.Data.SqlClient.SqlDataAdapter("SELECT * FROM Table",
return_SQLNATIVEConnection);
// DataSet erstellen
System.Data.DataSet local_DataSet = new System.Data.DataSet();
// DataSet füllen
local_DataAdapter.SelectCommand.CommandTimeout = 0
local_DataAdapter.Fill(local_DataSet, "DataSetTableName");
// Grid füllen
this.YourDataGrid.DataSource = local_DataSet
**************
For reload/refresh just run this code.
Best regards
Frank
"Mark" wrote:
Frank -
Would you suggest the code that I need to use to "refresh" the dataset?
I'm at a loss.
Thanks,
Mark
"Frank Uray" wrote:
Hi
I think you first have to reload the DataSet,
the grid will refresh automaticaly when DataSet is changed.
Frank
"Mark" wrote:
Hi -
>
I'm having trouble refreshing a datagrid control bound to a dataset that was
created from the New Data Source wizard. What is the code required to
refresh the datagrid with data from the data source (sql db)?
>
More Details:
>
The application is C# Windows (VS 2005).
>
I used the "Add New Data Source" wizard to connect to a sql database and
select the tables to include in the in-memory dataset.
>
From the Data Source window, I selected a table, designated it as a datagrid
and then dragged it onto the form. So far so good. The form runs fine, the
data grid populates properly.
>
Now I want to refresh the datagrid control. (I know the sql db has updated
(values changed, new records inserted), after the form was started.) I have
added a button to the form (named "Refresh Grid") and want to add code to
it's click event to do the refreshing. My question is what is the code that
is needed to requery the sql database?
>
Thanks for your suggestions.
Mark