Binding problem?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a winform with a data adapter defined thru the wizard in the usual
fashion for editing a single table. I call AddNew and enter my data. I
then do a EndCurrentEdit call and the thing crashes, complaining about how a
null field is not allowed, even though that textbox is filled in and is bound
to that db field. (Furthermore, that field has an assigned default value in
the database.)

Any suggestions?
 
What do you mean 'for all the bound textboxes'? I thought one EndCurrentEdit
call took care of all binding to a particular table?
 
The specific problem described in my original letter was caused by grossly
mistaken attempt to prevent a crash in the Load event (which did, but also
destroyed all binding, hence the null error messages on EndCurrentEdit.).

As it stands now, I know how to edit existing records using Fill and
update. No problem. I know how to call AddNew from dataset that has
already been filled. No problem.

The real problem as I see it now is: Is it possible to add records without
first calling Fill? I don’t want to read any records. I just want to add
one. The dataset has already been instantiated and bound.

To add to my confusion the Fill method documentation refers to 'adding
tables' to the data set. Yet, if I do not call Fill and try to add a table
manually I get an error: ‘A datatable named ‘Customer’ already belongs to
this dataset.’ (I suspect I’m overlooking some key concept in dataset
manipulation. Still, given that this instance of a dataset already has a
specific data structure, I can’t see why I can’t manually add datarows.)
 
I've mailed 2 zip files to your hotmail address (minus the NOSPAM of course).
Please let me know if you haven't received them.

Thanks,

B. Chernick
 
I've double checked my code for the customer screen and I'm pretty sure that
all fields are selected and bound. Beyond that, this article is nothing new.


I still can't help wondering why it's always the FirstName field (2nd in the
table) that's the one the system complains about. Could the order in which
they're bound mean anything? The txtFirstName control is the last one bound.

(Of course it's 2 in the morning here and I've got insomnia so everything I
do should be double checked as well :-)
 
Back
Top