我在C#中使用2005 Windows窗體。我只在這工作了一天,所以請容易。DataGridView更新
我想要一個提交按鈕,保存對DataGridView的更改。我已將數據導入DGV並可進行編輯,但卡在Update()上。
我創建了名爲scDB的.xsd和一個名爲 - SSIS Configurations Staging的DataTable。然後我添加了一個帶有參數的新查詢。
這裏是我到目前爲止的代碼:
//Declared at top of form class
scDBTableAdapters.SSIS_Configurations_StagingTableAdapter myStagingTableAdapter = new scDBTableAdapters.SSIS_Configurations_StagingTableAdapter();
//After a form event
stagingGrid.DataSource = myStagingTableAdapter.GetDataBy(filterName.Text.ToString());
//On Submit click:
myStagingTableAdapter.Update(?What Goes Here?);
什麼獲取傳遞給Update方法?我知道它需要一個dataTable,但我不知道如何引用GridView中的內容。在大多數代碼示例中,人們定義了DataTable - 但我不知道。我認爲這是在創建TableAdapter時幕後完成的。謝謝您的幫助。
是的,這工作,但我會嘗試你所提到的。謝謝。 – Sam 2009-02-13 23:48:53