Вот такая задача: Я загрузил в Dataset таблицу Questions из базы данных, а затем из Dataset в Datagrid вот так: Dim ds As Dataset ... Dim Conn As OleDbConnection Dim Comm As OleDbCommand Dim Ad As OleDbDataAdapter Conn = New OleDbConnection() Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\qa.mdb" Conn.Open() Comm = New OleDbCommand("Select * From Questions", Conn) Comm.Connection = Conn 'Comm.CommandText = "Select * From Questions" DS = New DataSet() Ad = New OleDbDataAdapter() Ad.SelectCommand = Comm Ad.Fill(DS, "Questions") DataGrid1.DataSource = DS Conn.Close() Conn = Nothing Затем я делаю в Datagrid кое-какие изменения и пытаюсь сохранить назад в БД: Dim Conn As OleDbConnection Dim Comm As OleDbCommand Dim Ad As OleDbDataAdapter Conn = New OleDbConnection() Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "C:\qa.mdb" Conn.Open() Comm = New OleDbCommand() Comm.Connection = Conn Comm.CommandText = "Select * From Questions" Ad = New OleDbDataAdapter() Ad.SelectCommand = Comm ds = DataGrid1.DataSource Ad.Update(ds) На последней строчке выдаёт: --- An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll Additional information: Update unable to find TableMapping['Table'] or DataTable 'Table'. --- Что я сделал не так?
Ответить
|