Background:
I have a data entry form that is bound to a DataSet. This DataSet contains
9 tables and the form displays data from each table in textboxes, not a
DataGrid. One of the tables in the ParentTable and the rest are children.
For Example:
The form shows the Customer and their most recently added Contact (in
textboxes, not in a DataGrid). When I click the Add button on the form, I
enumerate through all of the DataTables in the DataSet and call
BindingContext(DataTable).AddNew(). (Now, make note that the end user may
not always decide to enter a contact's information.) (For this example,
assume that the user did not enter a contact.) When the user clicks on Save,
I again enumerate through all of the DataTables in the DataSet and call
BindingContext(DataTable).EndCurrentEdit(). At this point every table in the
DataSet shows as having 1 row. When really the row for the Contacts table is
blank. This creates problems when trying to insert the data into the
database.
Is there a better way of doing this? I know that I could watch for entry
into any of the fields for the Contacts table and then call AddNew, but that
would be cumbersome to code.
PS - I know that the best way to do this would be to have a button that the
user clicks on to "Add New Contact" and then display a dialog form that would
allow the end user to enter the nessary information, or even just enable the
controls on the main form. That is the best and easiest way to accomplish
what I need to accomplish, however, my client wants it done the way described
above. They are moving from a DOS-based DBase application and want this to
act as much like the old app as possible.
Thanks in advance!! 5 3097
ASPNOT,
Have a look at this one. http://www.vb-tips.com/default.aspx?...8-2e91e5295e7c
In the same way as in this sample at the delete in this sample you can of
course as well try the rejectchanges http://msdn.microsoft.com/library/de...angestopic.asp
I hope this helps,
Cor
"Aspnot" <NO******************@nc.rr.com> schreef in bericht
news:62**********************************@microsof t.com... Background: I have a data entry form that is bound to a DataSet. This DataSet contains 9 tables and the form displays data from each table in textboxes, not a DataGrid. One of the tables in the ParentTable and the rest are children.
For Example: The form shows the Customer and their most recently added Contact (in textboxes, not in a DataGrid). When I click the Add button on the form, I enumerate through all of the DataTables in the DataSet and call BindingContext(DataTable).AddNew(). (Now, make note that the end user may not always decide to enter a contact's information.) (For this example, assume that the user did not enter a contact.) When the user clicks on Save, I again enumerate through all of the DataTables in the DataSet and call BindingContext(DataTable).EndCurrentEdit(). At this point every table in the DataSet shows as having 1 row. When really the row for the Contacts table is blank. This creates problems when trying to insert the data into the database.
Is there a better way of doing this? I know that I could watch for entry into any of the fields for the Contacts table and then call AddNew, but that would be cumbersome to code.
PS - I know that the best way to do this would be to have a button that the user clicks on to "Add New Contact" and then display a dialog form that would allow the end user to enter the nessary information, or even just enable the controls on the main form. That is the best and easiest way to accomplish what I need to accomplish, however, my client wants it done the way described above. They are moving from a DOS-based DBase application and want this to act as much like the old app as possible.
Thanks in advance!!
Cor,
Thanks for the reply. My example appears to have been lacking some
important information. Let me see if I can elaborate.
For ease, let's just consider a form that uses a DataSet that contains 2
tables named Customers and Contacts. The Contacts table can contain multiple
records for each Customer. On the form, I have a groupbox with information
about the customer and another groupbox with information about the last
contact created. The only buttons on the form are a New and Save button.
The New button creates a new customer (which in turn creates a new contact)
and the Save button saves the data. When the user clicks on the New button,
I do not know at that point whether they are going to enter a Contact or not,
so I call BindingContext(ds.Customers).AddNew() and
BindingContext(ds.Contacts).AddNew(). Assuming that the user entered data
for the customer, but not for the contact, when the user clicks Save, I need
a way to determine if information was entered for the contact section.
I know that I can loop through each field in ds.Contacts and determine if
any of them have values other than the defaults, but there has to be an
easier way.
If you have a better way of going about this, please let me know.
Again, thanks.
"Cor Ligthert [MVP]" wrote: ASPNOT,
Have a look at this one.
http://www.vb-tips.com/default.aspx?...8-2e91e5295e7c
In the same way as in this sample at the delete in this sample you can of course as well try the rejectchanges
http://msdn.microsoft.com/library/de...angestopic.asp
I hope this helps,
Cor
"Aspnot" <NO******************@nc.rr.com> schreef in bericht news:62**********************************@microsof t.com... Background: I have a data entry form that is bound to a DataSet. This DataSet contains 9 tables and the form displays data from each table in textboxes, not a DataGrid. One of the tables in the ParentTable and the rest are children.
For Example: The form shows the Customer and their most recently added Contact (in textboxes, not in a DataGrid). When I click the Add button on the form, I enumerate through all of the DataTables in the DataSet and call BindingContext(DataTable).AddNew(). (Now, make note that the end user may not always decide to enter a contact's information.) (For this example, assume that the user did not enter a contact.) When the user clicks on Save, I again enumerate through all of the DataTables in the DataSet and call BindingContext(DataTable).EndCurrentEdit(). At this point every table in the DataSet shows as having 1 row. When really the row for the Contacts table is blank. This creates problems when trying to insert the data into the database.
Is there a better way of doing this? I know that I could watch for entry into any of the fields for the Contacts table and then call AddNew, but that would be cumbersome to code.
PS - I know that the best way to do this would be to have a button that the user clicks on to "Add New Contact" and then display a dialog form that would allow the end user to enter the nessary information, or even just enable the controls on the main form. That is the best and easiest way to accomplish what I need to accomplish, however, my client wants it done the way described above. They are moving from a DOS-based DBase application and want this to act as much like the old app as possible.
Thanks in advance!!
ASPNOT,
Did you try the sample, if you use that for both your customers and your
contacts than you get in my idea a nicer application with much less work.
Your contacts should than have in the rowfilter of the defaultview the id of
the customer.,
In your case I would just use the sample. It is so easy to try and probably
is changing your program than almost no work.
I hope this helps,
Cor
I looked at the example on your site and that uses navigation buttons to move
around and to add a new record. That would be far too easy for this client.
They do not want to have to click a button to add a Contact. They want to
click the Add New button for the Customer and have it automatically set them
up with a blank Contact. Then they want to let the application determine
whether they typed anything into the Contact or not.
I am currently working on some code to loop through each DataTable in the
DataSet and then each DataRow in the DataTable and then through each
DataColumn in each DataRow to compare the values to the Default values to see
if any changes have been made to the data for the Contacts table. I find
this way of doing it to be very cumbersome. There has to be a better way. I
have run into an issue with this mechanism that if I RejectChanges() on a
DataRow, then I can no longer enumerate through the DataRows since the
collection has now changed.
"Cor Ligthert [MVP]" wrote: ASPNOT,
Did you try the sample, if you use that for both your customers and your contacts than you get in my idea a nicer application with much less work.
Your contacts should than have in the rowfilter of the defaultview the id of the customer.,
In your case I would just use the sample. It is so easy to try and probably is changing your program than almost no work.
I hope this helps,
Cor
Aspnot,
I don't find it an advanced application that your customer wants, sounds as
from the first ms DOS 1.1 time, however that is what you wrote.
Now I assume that you just want to know the rowstate of the last edited row. http://msdn.microsoft.com/library/de...classtopic.asp
I hope this helps,
Cor
"Aspnot" <NO******************@nc.rr.com> schreef in bericht
news:F8**********************************@microsof t.com... I looked at the example on your site and that uses navigation buttons to move around and to add a new record. That would be far too easy for this client. They do not want to have to click a button to add a Contact. They want to click the Add New button for the Customer and have it automatically set them up with a blank Contact. Then they want to let the application determine whether they typed anything into the Contact or not.
I am currently working on some code to loop through each DataTable in the DataSet and then each DataRow in the DataTable and then through each DataColumn in each DataRow to compare the values to the Default values to see if any changes have been made to the data for the Contacts table. I find this way of doing it to be very cumbersome. There has to be a better way. I have run into an issue with this mechanism that if I RejectChanges() on a DataRow, then I can no longer enumerate through the DataRows since the collection has now changed.
"Cor Ligthert [MVP]" wrote:
ASPNOT,
Did you try the sample, if you use that for both your customers and your contacts than you get in my idea a nicer application with much less work.
Your contacts should than have in the rowfilter of the defaultview the id of the customer.,
In your case I would just use the sample. It is so easy to try and probably is changing your program than almost no work.
I hope this helps,
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Iain Miller |
last post by:
Struggling a bit here & would be grateful for any help.
I have a table which has a list of people in it. Each person has a unique ID
automatically allocated by Access but also belongs to one of 5...
|
by: tamilan71 |
last post by:
Can anyone tell me a simple method of creating an application in Access
2003 that uses "Double data entry"? For me double data entry is defined
as the ability to have data entered twice. The first...
|
by: filbennett |
last post by:
Hi Everyone,
I'm generally unfamiliar with Access form design, but have programmed
Cold Fusion applications for a couple of years.
I'd like to build a data entry form in Access that allows the...
|
by: x |
last post by:
hi
i am a pilot by profession. i want to create a database of my logbook
using ms access 2002. i am facing a problem regarding the format of
time field. when i select "Data/Time" data type for my...
|
by: Sethos |
last post by:
I am sure that this has been covered, hashed, and rehashed, but a
search on the group did not produce the answer, so forgive me if this
seems like a "newbie" type question...
Besically, I have a...
|
by: Brian Blair |
last post by:
I have created a input form that enters a number in a talble. If I
open the form again it enters a new record instead of editing the
existing record. It seems like it should be very basic but I...
|
by: bosmatthews |
last post by:
I have a main form with a subform and a second subform nested to the first subform. The data entry property for all three forms (main, subform and sub-subform) is set to "yes" because I am intending...
|
by: hippomedon |
last post by:
Hello everyone,
I'm looking for some advice on whether I should break the
normalization rule. Normally, I would not consider it, but this seems
to be a special case.
I have created an...
|
by: Data Entry Outsourcing |
last post by:
Data Entry plays vital role in every business area. Data Entry is one
such aspects of any business that needs to be handled properly for
expanding your business. Data Entry is one of the leading...
|
by: Tyler |
last post by:
Made a data entry form which is a subform. I made a continuous form
that displays everything entered through the data entry form. The
data entry form displays all of the records. This doesn't...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |