Solved

Saving a sql record when combo box is empty.

Posted on 2013-06-12
2
234 Views
Last Modified: 2013-06-15
I have a small issue tracker vb .net app I created that uses sql server.
I have 2 tables, issues and related issues, joined on issueID in a 1 to many relationship.

My form has several fields, 2 of them are combo boxes which are Opened By and Assigned To
i created a dataset called Contacts, I then plop it onto each of the combo boxes, at this point everything is as expected. Scrolling through the records, each of the combo boxes is displaying the correct person.

The problem occurs when I need to blank out one of the combo boxes, Assigned To in this case. I then click save and close the form, now if I go back to the form to that record it still has the original person, not blank as expected. If I pick someone else instead of emptying the field and save it, then it does get saved.

Hopefully that's enough information to get an idea what my issue is.

Thanks
MW
0
Comment
Question by:WINN2012
2 Comments
 
LVL 1

Accepted Solution

by:
jay813 earned 500 total points
ID: 39243154
What does your update statement look like?  When you say 'blank' are you meaning you are trying to set the field for [Assigned To] to 'null' in the DB?  Have you tried using something like "N/A" (or a string value) instead of leaving it 'blank' to see if that works?
0
 

Author Comment

by:WINN2012
ID: 39243168
Its the normal save when you add a dataset to a form. Its on my work pc so I can't paste it atm.
Yes I basically want to set the value to null in the DB, all I am doing is deleting the users name from the field.
I had thought about adding a N/A to the Contacts Table as you mentioned.

Thanks
MW
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

830 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