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


Datagridview Blank Value

Posted on 2012-08-22
Medium Priority
Last Modified: 2012-08-22

I have a bound datagridview and I'm currently having an issue with null values.

I have 2 fields which are number datatypes, in some cases I have to delete a value in these fields and basically leave it blank, the problem is that vb.net refuses to save a null value to the database for these fields, I have no problem saving null values with string datatypes, but numbers have to be set to 0, so I end up with a table full of 0 values when we need to remove values.

I don't understand why when a field is a string, vb.net can save a null value, but if it's a number, it doesn't seem to detect that the field has changed to a null value; The dataset is set to accept Null values for these fields; I'm not sure what's missing!

Thank you
Question by:FCapo
  • 2
  • 2
LVL 83

Accepted Solution

CodeCruiser earned 1500 total points
ID: 38320727
This usually happens when you have integer data type involved at some stage. Can you show us your code?

Author Comment

ID: 38320905
my datatypes are set to System.Double for these 2 fields which are connected to number fields in my access database

Expert Comment

ID: 38320924
how you saving the values to database ?

Author Comment

ID: 38320962
I basically pass the updated dataset from vb.net to my database :

    Public Function savePrjAccessDataset(ByVal prjData As nclMisDataSet) As Boolean
            Return True
        Catch ex As Exception
        End Try

    End Function
LVL 83

Expert Comment

ID: 38321287
And do you get error on this update line?

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

873 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