using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void mytableBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this .Validate();
this .mytableBindingSource.EndEdit();
this .tableAdapterManager.UpdateAll(this .mydbDataSet);
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: данная строка кода позволяет загрузить данные в таблицу "mydbDataSet.mytable". При необходимости она может быть перемещена или удалена.
this .mytableTableAdapter.Fill(this .mydbDataSet.mytable);
// this.mytableDataGridView.AutoResizeColumns();
}
public DataRow lastdatarow = null;
private void updateRowToDatabase()
{
if (lastdatarow != null)
{
if (lastdatarow.RowState == DataRowState.Modified)
{
mytableTableAdapter.Update(lastdatarow);
}
}
}
private void mytableBindingSource_PositionChanged(object sender, EventArgs e)
{
BindingSource this BindingSource = (BindingSource)sender;
DataRow this datarow = ((DataRowView)this BindingSource.Current).Row;
if (this datarow == lastdatarow)
{
throw new ApplicationException("It seems the" +
" PositionChanged event was fired twice for" +
" the same row" );
}
updateRowToDatabase();
lastdatarow=this datarow;
}
private void button1_Click(object sender, EventArgs e)
{
updateRowToDatabase();
}
}
}
Сделал как в статье, такая же ошибка. Просит UpdateCommand. А что это и с чем его едят...