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

x
?
Solved

Datagridview Blank Value

Posted on 2012-08-22
5
Medium Priority
?
534 Views
Last Modified: 2012-08-22
Hi,

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
0
Comment
Question by:FCapo
  • 2
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
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?
0
 

Author Comment

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

Expert Comment

by:itmarsolutions
ID: 38320924
how you saving the values to database ?
0
 

Author Comment

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

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

    End Function
0
 
LVL 83

Expert Comment

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

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