By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,180 Members | 1,144 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,180 IT Pros & Developers. It's quick & easy.

Add record in bound form

P: n/a
Hi

In .NET I created a form with bound controls (Access Database). I used a dataset and followed examples to create a navigation using the Binding Context. So far everything goes well
My question, how do I add a new record to the database AFTER the user filled in the fields on the form. When the user presses a buttonNEW all controls (bound) need to be empty on the form so the user can fill in the fields. When the user presses the buttonSAVE the record needs to be saved. The problem is that my database has some fields that are required before I can add the row to the database. I can't find a solution anywhere.

Do you know how to do this. How to display a new row in a form with bound controls.

Thx in advance!
Mauric

Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Maurice:
"Maurice" <an*******@discussions.microsoft.com> wrote in message
news:C9**********************************@microsof t.com...
Hi,

In .NET I created a form with bound controls (Access Database). I used a dataset and followed examples to create a navigation using the Binding
Context. So far everything goes well. My question, how do I add a new record to the database AFTER the user filled in the fields on the form. When the user presses a buttonNEW all
controls (bound) need to be empty on the form so the user can fill in the
fields. When the user presses the buttonSAVE the record needs to be saved.
The problem is that my database has some fields that are required before I
can add the row to the database. I can't find a solution anywhere.
Do you know how to do this. How to display a new row in a form with bound controls..
Thx in advance!!
Maurice


Since you're using a BindingContext, you can all the .AddNew Method to add
a new row and effectively clear what's there. Now, you may want to consider
adding Default values to your respective DataColumns once you have your
dataset filled. When you add a new record, those values will populate
themselves, so its a must that everythign is blank, this won't do it for
you. however, once you hit the Save button, you can check the values of the
row and if they aren't there and are required, you can programatically add
them.

If you could tell me a little more about the overall scenario, I could be of
more help. For instance, are you only doing simple binding or are you using
Grid/ListBox/Combobox? Do you have any datarelations defined? what
specifically is the problem you have now, that you can't add a new row or
that it won't save on update?
Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.