We help IT Professionals succeed at work.

Re-Use DataTable for Data Entry

tobin46
tobin46 asked
on
255 Views
Last Modified: 2012-05-11
As the quest to drive myself nuts continues....(although I'm getting better....)

I have a datagridview that I bind, through code, a datatable to upon form load.  I enter data, click a "save" button and the datatable is "updated" to the database.  The form clears, and I want to enter another invoice on the form....  when I do this and click save again, by then calling the DA.update(DS, datatable), the data is not saved....I want this form to be used for data entry so that a user can enter X invoices in a row.

Can someone tell me what the proper steps should be to "re-use" the datatable in the datagridview?  
Comment
Watch Question

The problem is likely that the row is being updated, so it's not inserted the second time around. Have you tried calling DS.Clear after teh first write to the database?

Author

Commented:
Yes, tried ds.clear.  

The datatable is bound to the DGV, on form load, so does that matter?

CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
>the datatable is "updated" to the database.  The form clears,

Do you reload the form?

Author

Commented:
Reload meaning, go through re-creation of datatable, rebinding, etc.  If so, no.

Ideally, I would like it to appear seemless...user clicks save, and then continues in data entry mode on another invoice.

Author

Commented:
Any thoughts?
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
Can you post a screenshot of the interface?

Author

Commented:
@Cruiser - sure....sorry for delay, I've been traveling all day.  Please see attached Screenshot.

You will see the tab control...Each tab contains a datagrid I will bind a a datatable to.  The genesis of this whole project is that I hired someone and they ran out on me with partial payment.  This is a family owned business and I'm helping my father.  I programmed a long time ago....but not in DB's.
DWS-Screenshot.jpg
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
That worked!  

So there is no way of continuously using that datatable in one form?  That's something easily accomplished in Access.  
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014

Commented:
There are ways of doing that but above is the simplest way to reinitialize the form for next entry.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.