Solved

Adding Rows Through Windows Form to Table with Identity Column

Posted on 2006-06-26
2
211 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

Industry Leaders: 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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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