• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

Re-Use DataTable for Data Entry

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?  
0
tobin46
Asked:
tobin46
  • 5
  • 4
1 Solution
 
Jeff CertainCommented:
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?
0
 
tobin46Author Commented:
Yes, tried ds.clear.  

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

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

Do you reload the form?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
tobin46Author 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.
0
 
tobin46Author Commented:
Any thoughts?
0
 
CodeCruiserCommented:
Can you post a screenshot of the interface?
0
 
tobin46Author 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
0
 
CodeCruiserCommented:
Try this. At the end of Save button click, add this code

Dim f2 as New frmDWS
f2.show
me.close
0
 
tobin46Author Commented:
That worked!  

So there is no way of continuously using that datatable in one form?  That's something easily accomplished in Access.  
0
 
CodeCruiserCommented:
There are ways of doing that but above is the simplest way to reinitialize the form for next entry.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now