Solved

Adding Rows Through Windows Form to Table with Identity Column

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

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…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

773 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