Marty
6/29/2007 3:17:00 PM
Wen Yuan and Scott - thanks!
Yes - winform, not webform, code generated by the VS2005 IDE.
I apreciate your quick response. I have a much better understanding of the
"DataSet," "BindingSource," and "TableAdapter," now.
I was able to get Form1 to refresh by putting a tableAdapter.Fill() after
the modal call to Form2
private void NewButton_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.ShowDialog();
this.tableAdapter.Fill(this.dataSet.tablename);
}
Hopefully, there is no problem with calling tableAdapter.Fill repeatedly??
Thanks,
Marty
"WenYuan Wang [MSFT]" <v-wywang@online.microsoft.com> wrote in message
news:CdwyhMkuHHA.360@TK2MSFTNGHUB02.phx.gbl...
> Hello Marty,
> Thanks for Sccott's suggestion.
>
> At beginning, I'd like to check if you are developing Winform Application.
> (or WebForm Application?)
> I assume your application is developing in Winform project model. If I
> have
> misunderstood, please correct me. Thanks.
>
> Scrrot has provided the correct direction. Setting the data bindings is
> not
> what queries the data. In order to refresh the data, we would have to
> modify the underlying dataset/datatable.
>
> I'm not sure how you wrote the connection/query code (is it generated by
> VS
> 2005 IDE?). If all codes generated by VS 2005, I think there must be many
> components on form1 designer surface. (such as DataSet,
> BindingSource,TableAdapter and BindingNavigator).
> 1) To refresh the new data from underlying database, we would have to use
> TableAdapter to fill DataSet.
> public void refreshDataSource()
> {
>
> this.table_1TableAdapter.Fill(this.adventureWorksDataSet.Table_1);
> }
> 2) If you just want to add new row into the dataset, you could create
> AddRow() Method in Form1 class and call this method in Form2's unload
> event
> handler.
> public void addNewRow(AdventureWorksDataSet.Table_1Row newRow)
> {
> this.adventureWorksDataSet.Table_1.AddTable_1Row(newRow);
> }
>
> The issue sounds not complex. If you could let me know the actual
> scenario,
> I could provide a sample for you.
> Hope this helps
> Sincerely,
> Wen Yuan
> Microsoft Online Community Support
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>