Hello,

I have a form where the controls are linked to a Access database via Dataset
Adapter and DataSet. I can navigate in the dataset.

Now I'd like to use the same form to insert data.

For that, my idea is :
- SuspendBinding
- Clear TextBox
- User fill in the Textbox
- Insert in DataRow and after in Database
- ResumeBinding

But I have a problem, when I do this (see below)

I receive this error message (exception raised):
System.Windows.Forms
DataBinding could not find a row in the list that is suitable for all
bindings.

An idea ?

Thanks,

Christian,

The code, in the event button (ADD) click :
try
{
BindingManagerBase binMng=BindingContext [dsMyMovie, "MOVIE"];
binMng.SuspendBinding();
}
catch(Exception ex)
{
MessageBox.Show(ex.Source);
MessageBox.Show(ex.Message);
}

Re: SuspendBinding/ResumeBinding by Miha

Miha
Thu Dec 18 14:57:20 CST 2003

Hi Christian,

Didn't you overcomplicated a bit?

You should invoke BindingManagerBase.AddNew() method.
When you are finished editing you should call
BindingManagerBase.EndCurrentEdit().
There you have a DataRow in DataTable.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"Christian Ista" <mailing-list@istasofts.com> wrote in message
news:edAEkMaxDHA.3140@TK2MSFTNGP11.phx.gbl...
> Hello,
>
> I have a form where the controls are linked to a Access database via
Dataset
> Adapter and DataSet. I can navigate in the dataset.
>
> Now I'd like to use the same form to insert data.
>
> For that, my idea is :
> - SuspendBinding
> - Clear TextBox
> - User fill in the Textbox
> - Insert in DataRow and after in Database
> - ResumeBinding
>
> But I have a problem, when I do this (see below)
>
> I receive this error message (exception raised):
> System.Windows.Forms
> DataBinding could not find a row in the list that is suitable for all
> bindings.
>
> An idea ?
>
> Thanks,
>
> Christian,
>
> The code, in the event button (ADD) click :
> try
> {
> BindingManagerBase binMng=BindingContext [dsMyMovie, "MOVIE"];
> binMng.SuspendBinding();
> }
> catch(Exception ex)
> {
> MessageBox.Show(ex.Source);
> MessageBox.Show(ex.Message);
> }
>
>
>
>
>