ADO.net dataadapter.update
подключение....думаю тут все правильно...
scsb = new SqlConnectionStringBuilder();
scsb.DataSource = @".\SQLEXPRESS";
scsb.IntegratedSecurity = true;
scsb.AttachDBFilename = @"C:\Documents and Settings\name\Мои документы\Visual Studio 2008\Projects\Link_base\Link_base\LinkBase.mdf";
connection = new SqlConnection(scsb.ConnectionString);
connection.Open();
конструктор класа
dataGridView1.DataSource = bindingSource1;
заполнение таблицы dataGridView1 из БД с помощью DataTable
adapter = new SqlDataAdapter(cmd, connection);
builder = new SqlCommandBuilder(adapter);
table = new DataTable();
table.Locale = System.Globalization.CultureInfo.InvariantCulture;
adapter.Fill(table);
bindingSource1.DataSource = table;
далее самое интересное....не могу обновить БД
adapter.Update((DataTable)bindingSource1.DataSource);
или я еще пробовал так
adapter.Update(table);
короче и так и так выпадает ошибка!!
ошибка вот
"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."
еще буду признателен если мне обьяснят что такое SqlCommandBuilder(adapter); и что он делает... в мсдн читал но не понял...
Проверьте, есть ключ в таблице или включается ли он в источник строк таблицы.