Solved

Adding Rows Through Windows Form to Table with Identity Column

Posted on 2006-06-26
2
210 Views
Last Modified: 2010-04-23
Hi boys and girls,

I have a windows app with a form.  I've dragged and dropped a table from my dataset onto the form.  VS 2005 kindly adds a binding navigator that allows you to add, delete and save records.  Very nice.

The problem comes when I try to add a row to the table through the form.  The primary key of the table is an auto-incrementing identity column, so I don't want the form to pass a null to the table.  Wwhen it does so, of course, I get the "column x does not accept nulls" error.

How do I tell the form not to insert a value for the identity column?  Do I need to use a different binding source for inserts vs. updates and deletions (where the primary key value is required to update the row)?

TIA!
0
Comment
Question by:seadriver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
vadim63 earned 500 total points
ID: 16986633
Shouldn't be any problems. Can you see "AutoIncrement" has "true" value in Dataset Designer?
0
 

Author Comment

by:seadriver
ID: 16987120
Thanks, just needed to know where to look.

Now I'm getting errors on all the non-null columns that don't have related form controls setting values for them.  I'd like the database to set the default value, not the form, but for the heck of it, I went ahead and set the Default Value of the Status column to 'A' in the property box.  VS 2005 accepted the entry, then refused to display the form or the dataset designer, telling me that Status had an invalid default value.

How can a tool blow up on an entry it allowed you to make in the form designer???

Oh well, that's another issue.  Seems to me that this thing really isn't ready for prime time yet...

Thanks again!
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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 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