Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7419741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:07:26+00:00 2026-05-29T08:07:26+00:00

I have been looking for a solution to this problem for a while now

  • 0

I have been looking for a solution to this problem for a while now and am feeling really stuck; I can find solutions to problems that are similar, but not the same as mine.

I am pulling data from a local MSSQL database using a stored procedure, then send the data to a web service. Every part of the component works well except for a pesky problem will a DBNull being returned from the DataRow field, when I know that the field is not null and has valid data. The database and associated INSERT statements that add to this field are designed to not allow NULL entries. When I debug break the program on or right before the line that throws the error I see that the field has valid data for the current row.
If I add a null check to the code (as below) the operation continues as normal:

        Dim dataResultsTable = Me.myViewTableAdapter.GetData(int)

        For Each myDataRow In dataResultsTable.Rows
                        If worker.CancellationPending Then
                            e.Cancel = True
                        Else
                            If myDataRow.Item("syncd") = 0 Then
                               If IsDBNull(myDataRow.Item("bidamount")) Then
                                  _bidAmt = ""
                               Else
    // With out the null check this line throws an error
                                  _bidAmt = myDataRow.Item("bidamount") 
                               End If    

                               If IsDBNull(myDataRow.Item("date_time")) Then
                                  _dateTime = ""
                               Else
    // With out the null check this line throws an error
                                  _dateTime = myDataRow.Item("date_time")
                               End If

// . . . . . . . . 

                               worker.ReportProgress(percentcomplete)
                            End If
                         End If
                      Next

The question here is: Why is the read operation returning DBNull instead of the data in the database? Any and all help here is much appreciated!

EDIT: Just to be clear, the operation does return the proper data, but the data is not being saved into the variable.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:07:28+00:00Added an answer on May 29, 2026 at 8:07 am

    This is only a suggestion. In order not to use IsDBNull, why don’t you alter your Stored Procedure by converting default value for Null fields using COALESCE

    For example:

    SELECT COALESCE(bidamount,''), -- this will convert null value into empty one
           COALESCE(date_time,''), ..... 
    FROM .....
    

    as with your code _bidAmt = "" and _dateTime = ""

                        If worker.CancellationPending Then
                            e.Cancel = True
                        Else
                            If myDataRow.Item("syncd") = 0 Then
                                  _bidAmt = myDataRow.Item("bidamount")    
                                  _dateTime = myDataRow.Item("date_time")
                            End If
                               worker.ReportProgress(percentcomplete)
                            End If
                         End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking for a while now but I can not find an
I've been looking for a solution to this for a while now, have found
Been wrapping my head around this problem for a while and looking for solutions
I have been looking everywhere but can't seem to find a good solution for
I have been trying for about an hour now to find an elegant solution
I have been looking around for solutions, and tried to implement what is often
I have been looking for an affordable solution for a client of mine. In
While I can find the answer to almost any specific question I have concerning
I have been googling/SO:ing this issue for a while and many seem to be
I have tried looking all over the place and couldn't find a good solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.