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

  • Home
  • SEARCH
  • 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 57379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:40:55+00:00 2026-05-10T17:40:55+00:00

I want to generate some formatted output of data retrieved from an MS-Access database

  • 0

I want to generate some formatted output of data retrieved from an MS-Access database and stored in a DataTable object/variable, myDataTable. However, some of the fields in myDataTable cotain dbNull data. So, the following VB.net code snippet will give errors if the value of any of the fields lastname, intials, or sID is dbNull.

   dim myDataTable as DataTable    dim tmpStr as String    dim sID as Integer = 1     ...    myDataTable = myTableAdapter.GetData() ' Reads the data from MS-Access table    ...     For Each myItem As DataRow In myDataTable.Rows      tmpStr = nameItem('lastname') + ' ' + nameItem('initials')      If myItem('sID')=sID Then         ' Do something     End If      ' print tmpStr     Next 

So, how do i get the above code to work when the fields may contain dbNull without having to check each time if the data is dbNull as in this question?

  • 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. 2026-05-10T17:40:55+00:00Added an answer on May 10, 2026 at 5:40 pm

    The only way that i know of is to test for it, you can do a combined if though to make it easy.

    If NOT IsDbNull(myItem('sID')) AndAlso myItem('sID') = sId Then    'Do success ELSE    'Failure End If 

    I wrote in VB as that is what it looks like you need, even though you mixed languages.

    Edit

    Cleaned up to use IsDbNull to make it more readable

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer First off you are going to need some hardware to… May 11, 2026 at 11:27 am
  • added an answer MySQL support ISO-8601 date/time values, and no others. If you… May 11, 2026 at 11:27 am
  • added an answer I would use functools.partial and functools.wraps: from functools import partial,… May 11, 2026 at 11:27 am

Related Questions

I want to generate some formatted output of data retrieved from an MS-Access database
I want to generate some XML in a stored procedure based on data in
I need to generate some passwords, I want to avoid characters that can be
Using T4 I want to generate some code based on examining what files are
I have a task and I want to generate some code using the CodeDom.
I want to auto-generate a HTML table from some custom data. One of the
I want to make some variables I generate in b available in c: a
I'm looking for a free templating engine to generate simple reports. I want some
What I'm trying to accomplish My app generates some tabular data I want the
I want to generate a thumbnail preview of videos in Java. I'm mostly JMF

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.