[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

move row from one bound datagrid to another

Posted on 2011-10-07
4
Medium Priority
?
236 Views
Last Modified: 2012-05-12
I have 2 data grids bound to an access database with binding sources and navigators.  The main data has an auto generated number for the index.  The archive data has the index set to number.  I want to use the same number from the main data because that is the unique ID for that information.  When I try to copy the row to the archive and delete it from the main I get an error that the index column can't contain a null value when trying to update the archived data.  The ID column has the number from the main data in the cell so this is very confusing.  The archive has additional columns in it for dates so it's not a direct copy of the row but all of the information is in the cells before it tries to save.
0
Comment
Question by:mmosoul
  • 3
4 Comments
 
LVL 10

Expert Comment

by:gavsmith
ID: 36931805
Have you double checked that the insert command includes the ID column for the archive table, also how is the ID column setup for the archive table? To debug this you could allow all the columns in the archive table to allow nulls, then take a look at the table after inserting a row from the main table.

Hope that helps
0
 

Author Comment

by:mmosoul
ID: 36932374
How do I look at the insert command?  It's bound data with a navigator.  I press the add row button, enter the data then press the save button.  I don't pass it any insert commands or anything.

Save button:
        If Me.Validate() = True Then
            Me.PoarchiveBindingSource.EndEdit()
            Me.PoarchiveTableAdapter.Update(Me.PolistDataSet.poarchive)
        End If

Open in new window

0
 
LVL 10

Expert Comment

by:gavsmith
ID: 36940967
If you have used the wizards to create a binding datasource you (most likely, there are several different ways) may have created a dataset, so in your solution explorer you may have 'DatabaseNameDataSet.xsd'?

If so, expand that and you'll see 'DatabaseNameDataSet.Designer.cs' if you open that and look at InitAdapter, specifically the line the starts:

this._adapter.InsertCommand.CommandText = @"INSERT INTO

you should see your insert command and below the parameters that are getting passed to it.

P.S I'm making a lot of assumptions as to how you have set this up... please let me know if I'm wrong.
0
 
LVL 10

Accepted Solution

by:
gavsmith earned 2000 total points
ID: 36941003
Actually I've just re-read your code and there is a reference to a table adapter in the code (PoarchiveTableAdapter) the insert command may be on that table adapter.
0

Featured Post

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question