Typed Dataset and Bound Controls Error

M

Michael Jackson

I'm using typed datasets with bound VS2003 Winform controls. In my code to
add a new record, I get the following error:
"Databinding could not find a row in the list that is suitable for all
bindings."

At this point, my database table is emtpy.

Simple Code:
Me.BindingContext(objDocRvwCatDS,
"DocumentReviewCategories").EndCurrentEdit()

Me.BindingContext(objDocRvwCatDS, "DocumentReviewCategories").AddNew() <---
throws the exception

Any ideas what would be causing this?

Michael
 
G

Guest

Michael,

Maybe you should post your binding code, but I have the feeling that you're
mixing two binding methodologies somewhere.

When you bound your control, say a TextBox, you have a choice of two
different syntaxes:

MyTextBox.DataBindings.Add("Text", MyDataSet, "MyTable.MyColumn")

-or-

MyTextBox.DataBindings.Add("Text", MyDataSet.MyTable, "MyColumn");

If you used the first syntax, then your code to AddNew should be what you've
already used:

BindingContext(MyDataSet, "MyTable").AddNew()

but if you used the second syntax, then you'll want to do it this way:

BindingContext(MyDataSet.MyTable).AddNew()

~~Bonnie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top