0
嗨,大家好,我試圖通過datagridview的一個按鈕來保存數據到數據庫中,但我每次運行應用程序和時間在這裏我得到了下面的錯誤是我的代碼:更新MS Access數據庫通過DataGridView的
DataTable Table = new DataTable();
BindingSource bindingSource1 = new BindingSource();
string connetionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Database/Database.accdb;";
string sql = "SELECT * FROM IAE;";
OleDbConnection connection = new OleDbConnection(connetionString);
OleDbDataAdapter dataadapter = new OleDbDataAdapter(sql, connection);
OleDbCommandBuilder cb = new OleDbCommandBuilder(dataadapter);
DataSet ds = new DataSet();
connection.Open();
dataGridView1.DataSource = ds.Tables["IAE"];
dataadapter.Update((DataTable)bindingSource1.DataSource);
connection.Close();
的錯誤:值不能爲空。參數名:dataTable的
需要你的幫助,感謝